Skip to content Skip to sidebar Skip to footer

Update Postgresql Database With Node.js

I am trying to update a PostgreSQL table so for that I'm creating two arrays: var name_ = []; var id_ = []; Then I create a forEach loop where MyRow is a query that contains diff

Solution 1:

I'm not sure the error is related, but where is shema mentioned? Also use backticks, oneLine and const on template strings.

const updateAccount = oneLine`
   UPDATE myTable
   SET myRow =$1WHERE shema.id =$2--whereis `shema` defined?
`;

Solution 2:

My guess is that you should enclose your values in single quotes.

var updateAccount = "UPDATE myTable SET myRow = '$1' "+
"where shema.id = '$2'"

In your example, your values are interpreted as column names, so PostgreSQL asks you to specify a table containing these.

Post a Comment for "Update Postgresql Database With Node.js"