I just started to learn nodejs-postgres and found the pg-promise package. I read the docs and examples but I don't understand where should I put the initialization code? I using Express and I have many routes.   I have to put whole initializati...
I'm trying to follow the performance pattern recommended by the pg-promise library author here.  Basically Vitaly recommends to do so with inserts :   var users = [['John', 23], ['Mike', 30], ['David', 18]];  // We can use...
I was searching the documentation of pg-promise specifically in the creation of the client. But I wasn't able to find the option to set the default schema to be used in the connection, it always uses public schema. How do I set it?...
I have the following query that inserts data into a many-to-many join table  INSERT INTO playlist_genre(playlist_id, genre_id) VALUES  (${playlistId}, ${genre1Id}),         (${playlistId}, ${genre2Id}),         (${playlistId}, ${genre3Id}) );   Howev...
From example where-col-in example and this answer, WHERE IN clauses should have query with parameters with following syntax  const response = await db.any('SELECT * FROM table WHERE id IN ($1:csv)', [data])   where data is an array.  Now, whe...
I am using pg-promise. i am learnner please excuse if it seems trivial to you. how can i wrtie unit test for. it errors out data is undefined. i have been making connection in js file and export that module.another js file use to query against databa...
So I am using pg-promise to insert multiple geojson MultiPolygons into a postgis database. The insertion into the database work fine, but for some of the row in the database I get a strange behaviour, that is the cell is filled with two lines. The fi...
When we execute queries to our PostgreSQL Database and receive responses, we then pass these responses to our clientside to display/work with.  Example:  const response = [   {     first_name: 'Bob',     last_name: 'English',     titl...
My pg-promise query (2 ids in array passed in):  db.any(`SELECT * FROM users WHERE user_id IN ($1:csv)`, team.member_ids)   Console output of query and params passed to pg-promise:  SELECT * FROM users WHERE user_id IN ($1:csv) [ 1, 2 ] //Fails one r...
I'm having trouble understanding the output printed why executing this code :  1 2 Unhandled rejection Error: Callback was already called.  It seems like both then and catch are executed when the query is successful.  Any idea ?  Cheers      asyn...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.