How can I return results with parameterized query in Nodejs?
Query runs fine if I remove RETURNING*
Right now, server returns this error
error: syntax error at or near "RETURNING"
server.js
const text = "UPDATE users SET info = JSONB_SET(info, '{geometry,coordinates}', '"+coords+"') WHERE id=$1 RETURNING*";
const values = [id];
pool.query(text, values, (err, res) => {
if (err) {
//log errors
console.log(err.stack);
//return error to client
} else {
//success
//console.log(res.rows);
}
});
*andRETURNING?RETURNINGhave a space afterRETURNINGfollowed by either a*to return all fields or a list of fields to return. If there's no space after it will be seen asRETURNING*.