I try to Update a table on postgresql so for that i'm creating two arrays
var name_ = [];
var id_ = [];
then i creat a forEach loop where MyRow is the query that contain different data
MyRow.rows.forEach(function(row){
name_.push(row.name);
id_.push(row.id);
});
var updateAccount = 'UPDATE myTable SET myRow =$1 '+
'where id = $2'
client.query(updateAccount,[name_.toString(),id_.toString()],false).then(function(err,result){
if (err) {
console.log(err.stack);
} else {
console.log(name_)
}
});
then i had an error error: missing FROM-clause entry for table "myTable "
I'm not sure the error is related, but where is
shema
mentioned? Also use backticks,oneLine
andconst
on template strings.My guess is that you should enclose your values in single quotes.
In your example, your values are interpreted as column names, so PostgreSQL asks you to specify a table containing these.