As the title says, I'm running into a syntax error using node-postgres. Here's what the code looks like
const {Pool, Client} = require('pg')
const pool = new Pool({
user: '<user>',
host: '<host>',
database: '<database>',
password: '<pw>',
port: <port>
})
let query = `SELECT * FROM user JOIN notifications ON user.user_id = notifications.user_id WHERE user_id=$1`
let values = ["123"]
pool.query(query, values)
.then(() => { /* do something */} )
.catch((err) => { console.log(err)} )
Based on this query, I get a syntax error with the message
syntax error at or near "."
Since the same query runs fine in pgAdmin, my guess is that it's module specific, but I haven't figured out what the problem is.
Any help much appreciated!
Edit: added missing bracket, thanks to Sreeragh A R