Questions tagged [node-postgres]

Node-postgres is a postgresql client module for node.js applications to interact with postgresql databases.

About

Node-postgres is a postgresql client module for node.js applications to interact with postgresql databases.

Its source code and wiki can be found on GitHub.

450 questions
0
votes
1 answer

Is it possible to set postgres search_path in node-postgres?

I'm moving an application from RoR to Express.js. ActiveRecord postgres adapter has the search_path configuration option. Is it possible to set the search_path for the Client ?
0
votes
1 answer

Postgres: How to 'INSERT INTO ... IF NOT EXISTS ...'

I've got a postgres table keeping track of schedule time slots for a couple of different schools and I'm trying to write a function (in javascript using the node-postgres library) that inserts 1 new row per time slot per day per school for the…
Evan
  • 3
  • 1
0
votes
1 answer

node.js with PostgreSQL and socket.io Error: Socket is not writable

I've been playing around with socket.io and it seems to have been working nicely. Lately though, I installed postgreSQL to insert rows to the database everytime an event happens (and the event happens 2 or 3 times per second!)... Here's a…
meltuhamy
  • 2,873
  • 4
  • 19
  • 22
-1
votes
1 answer

How to do an If-Else Condition inside a Transaction in Postgresql

I've written a transaction block in Postgresql (via node-postgres) and it's working fine, although I would like to ask if it's possible (and how) to put an if-else condition within the transaction block. This is my current code (working as…
TechArtificer
  • 97
  • 1
  • 7
-1
votes
3 answers

node-postgres returning undefined result

When i try to get result from node-postgres from my express app, pool.query is returning undefined result when i log it in console. Not sure if its about database connected properly or I am not returning the result properly? I am using heroku to…
Pho
  • 81
  • 6
-1
votes
2 answers

How do I properly save this JSONB into PostgreSQL using node-postgres (pg)?

So I have information coming in the GET URL, which needs to get passed into JSON and then saved (aggregated with increasing IDs to be correct) in the PostgreSQL DBMS. I wrote the following code, which seems to not save anything with no errors: // Pg…
Munchkin
  • 503
  • 1
  • 7
  • 25
-1
votes
2 answers

node async/await not working for me (when using Postgres / Node - working with DB updates before going to next call)

await is not blocking as expected, when a block of code updates db (using postgres / node ) https://node-postgres.com I have a list of async function calls, each call udpates a database, and each subsequent call works on data updated by the previous…
user10664542
  • 642
  • 6
  • 24
-1
votes
1 answer

postgres update query is not working in node,js

I have an update query which seems to be not working. The underlying database used is postgres. Could you please check why it is not working? I have included my api and schema. Thanks in advance exports.patch_meetup = async (req, res) => { const…
Kaztech
  • 3
  • 3
-1
votes
1 answer

Compare data within multiple queries - Postgres Node.js

So I am creating an API endpoint where I send in two different types of data from the UI. One is a string and the other is an array containing upto 5 items. I need to compare the results across the queries and get data as the following. This is a…
a2441918
  • 1,835
  • 2
  • 12
  • 31
-1
votes
1 answer

Is it possible run query COPY TO STDOUT WITH BINARY and stream results with node-postgres?

I'm worried about data-type coercion or will i get a nice Buffer or UInt8Array? Can I get it in chunks (streaming)?
Reinsbrain
  • 1,593
  • 2
  • 15
  • 30
-1
votes
1 answer

for loop inside query

I have this in mongo: //fill QueryString collection.find({"myID" : {$in:QueryString} },{}).toArray(function(err, Stuff) { ... var flag = true; for (var i=0; i
George
  • 5,620
  • 13
  • 72
  • 137
-1
votes
3 answers

node-postgres : query not executing in sequence

i have kept insert & update code in 2 different files and based on condition always insert should execute first and then update.but somehow update executes first then insert test.js : simplified code i am using these packages :pg , uuid var pg =…
Mr punch
  • 1,294
  • 2
  • 11
  • 23
-1
votes
1 answer

how to load 2 related datasets together? (i.e posts and comments)

I'm fairly new to pg and trying to figure out what the best approach is to loading a set of posts and their associated comments together. For example: I'm trying to fetch a 10 posts and comments associated with all those posts, like facebooks wall…
Saad
  • 19,836
  • 13
  • 41
  • 68
-1
votes
1 answer

Node pg library auto commit vs explicit commit

I am using Node pg to connect and use my Postgres Database. I use Postgres functions from node js to insert update or fetch data. I also use connection pooling to get connections to the DB. When using node PG let us say I fire an insert query, do I…
Vivek Anand Y
  • 21
  • 2
  • 7
-2
votes
1 answer

How to set up node-postgres?

I have a PostgreSQL, php5, running on Apache2.0 (on a Windows machine.) I want to be able to push updates to the client's browser when certain table rows are updated. I came across this https://github.com/brianc/node-postgres What & how do I set…
Joe B
  • 961
  • 9
  • 19
1 2 3
29
30