Javascript 错误:输入端的语法错误-Nodejs和PostgreSQL(Heroku)

Javascript 错误:输入端的语法错误-Nodejs和PostgreSQL(Heroku),javascript,sql,node.js,postgresql,heroku,Javascript,Sql,Node.js,Postgresql,Heroku,当用户第一次进入网站时,他会得到一个分配给他的特殊字符串。我将该字符串保存在包含用户IP的行中。因此,当用户进入网站时,我想查询数据库并询问它是否在表中找到他的IP。当我使用CLI时,我得到了一个syntex错误,如果IP存在,则查找并返回t,如果不存在,则返回f,这是应该的 守则: let thisIP = req.headers['x-forwarded-for'] || req.connection.remoteAddress || req.socket.remoteAdd

当用户第一次进入网站时,他会得到一个分配给他的特殊字符串。我将该字符串保存在包含用户IP的行中。因此,当用户进入网站时,我想查询数据库并询问它是否在表中找到他的IP。当我使用CLI时,我得到了一个syntex错误,如果IP存在,则查找并返回t,如果不存在,则返回f,这是应该的

守则:

let thisIP = req.headers['x-forwarded-for'] ||
    req.connection.remoteAddress ||
    req.socket.remoteAddress ||
    (req.connection.socket ? req.connection.socket.remoteAddress : null);

client.query("SELECT exists(SELECT 1 from registrations WHERE ip='" + thisIP + "'",
    (err, res) => {
        if (err) throw err;
        console.log(res.rows[0]);
    });
错误:

error: syntax error at end of input

缺少exists函数的右括号。

缺少exists函数的右括号。

括号在哪里!?我想你错过了。括号在哪里!?我想你错过了。