Search code examples
sqlnode.jspostgresqlcursor

nodejs & postgres : best way to do select for update


I need to do 'select for update' in postgres database from node.js, i.e obtain a cursor, iterate on it and updating values if needed.

I don't know if it is even possible in node.js and how.

I have found https://github.com/brianc/node-pg-cursor which seems good for reading cursor, but nothing for updating it.

Is there a module or pattern that can achieve this ?

Many thanks


Solution

  • As of today, there is no implementation for this within Node JS platform, so your only viable option is to implement it within a Postgres function and then just call it from Node JS.