Questions tagged [node-pg-pool]

A connection pool for node-postgres node.js

https://github.com/brianc/node-pg-pool A connection pool for node-postgres node.js

48 questions
1
vote
1 answer

1 db connection for all functions in API call

I have a route that handles API calls for timepunches. One of the calls is to "clock_in". router.route('/clock_in').post(managerCheck, startTimeCheck, isClockedIn, clockIn); Each of these functions will perform it's own db connection, query the db…
Philip Jay Fry
  • 105
  • 1
  • 6
1
vote
1 answer

Postgres sql script to manage database in nodejs

I am trying to automate database creation and dropping of tables on postgres sql from node.js. I have written a script that works well but its behaving in a weird manner. Let me post the code here first then explain this problem. db.js file …
japheth
  • 373
  • 1
  • 10
  • 34
1
vote
1 answer

How to get an Object without wrapping of square brackets in PostgreSQL using Node.js and express?

I'm using PostgreSQL with node-postgres: pool, Node.js and express to make some simple queries, I get in return the object wrapped with square brackets but I would like to get it without it. The employeeDA.js: const Pool =…
noam steiner
  • 4,034
  • 3
  • 27
  • 42
1
vote
1 answer

Unable to set NULL value in a column with type uuid which is nullable in Postgresql using Node JS

I am using node pg client, and I have a table create table test( id uuid not null constraint transactions_pkey primary key, name varchar(255), test_id uuid ); I am trying to update test_id to NULL but I am unable to do so…
Kushagara.K
  • 67
  • 2
  • 8
1
vote
1 answer

"UnhandledPromiseRejectionWarning" in nodejs even after adding catch block

I am writing an api server for a postgres database, and was testing some stress cases. I am using a pool from the module node-postgres, and ran into this problem. I first exhausted all the postgers connections before starting the server. Then i try…
1
vote
1 answer

Difference between pg and pg-pool module in NodeJs?

I am working on NodeJs project which involves connection with PostgreSQL database. I came across two packages, namely, pg and pg-pool. Creator of these two packages is same, so there must be some differences in the functionalities of these two…
user
  • 383
  • 1
  • 5
  • 20
0
votes
0 answers

AWS Lambda payload limit for pg-query / JSONStream

I am trying to stream larger payloads with node pg-query-stream. I am piping the JSONStream directly into my HTTP Response as process.stdout in this example. const pg = require('pg') var pool = new pg.Pool() const QueryStream =…
Dennis Bauszus
  • 1,624
  • 2
  • 19
  • 44
0
votes
0 answers

pass a timestamp as a parameter in the query using the node js postgre library (pg)

I'm trying to make a request to the database using the pg library of node js, as you can see in the code below i try to pass a parameter to the query with the date and time, but for some reason it does not return any data, unlike when I execute the…
0
votes
1 answer

How to safely call a variadic function from nodejs

Using postgres and node-pg. CALL schema.function(${sql}) function is a variadic function accepting an array. It is open to SQL injection. How can the injection case be resolved? My stored procedure uses a custom type: CREATE TYPE isf.event_array AS…
0
votes
0 answers

firebase functions postgresql max_connections best practice

Could not find any answer to this question google cloud function eats up all available postgresql connections library used pg@8.8.0 firebase reports 20 active users and postgresql is up to 100 parallel connection const client = await…
dsl400
  • 322
  • 3
  • 14
0
votes
0 answers

PG Pool: relation does not exist

I recently started coding in javascript. Been trying to use pg module to interact with my postgres db. But it keeps saying relation does not exist even though everything is okay and the table does exist. Any help will be appreciated. const Pool =…
0
votes
2 answers

Connecting with pg.Pool and GCP IAM-based database authentication

Currently, our api (deployed on cloudRun) connects to our Postgres database by passing in a pgConfig with a db configuration and a db user and password. For example: const configObject = { host: cloudRunHost, user: dbUser, password:…
0
votes
1 answer

node-postgres script does not end after it is finished

I have a script called scheduler() which runs some queries on a Postgres database and then finished. I am having a problem where the script hangs in the terminal and does not exit after. Here is my code: scheduler.js const {pool} =…
0
votes
2 answers

Async/Await with node-pg on digitalocean not returning anything

Hi I am trying to fetch data from server/index.js api endpoint data.getData() which is provided from api/data.js which in turn gets it's configuration and connection object from db/index.js. The problem is that the async/await is not returning…
Alonso
  • 43
  • 1
  • 8
0
votes
0 answers

Insert multiple values into a column of a table in PostgreSQL

Suppose I want to insert multiple rows into a table in PostregSQL. The example below shows how to do that using only one row, but what if I want to insert several rows? How to do that? If I have several names with the same email? const text =…
Aerodynamika
  • 7,883
  • 16
  • 78
  • 137