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...
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...
The function that I am working on is getting an input object that has 7 different key-values and each of them could be undefined or not. I want to filter my database based on those key-values that exists in the input. For example if only input.userID...
Is it possible to reference nested objects, when using named parameters with pg-promise, like the following example?  var obj = {     name: 'John',     address: {         postcode: 'abc'     } };  db.query('SELECT * FROM users WHE...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.