All Questions
Tagged with node-postgres promise
8 questions
0
votes
1
answer
728
views
Updating Multiple Tables using Node Postgres
I have two tables, one stores customer orders and the other stores items in a specific order. I am trying to update both these tables at once as follows:
const updateCustOrder = 'UPDATE orders SET ...
0
votes
1
answer
791
views
How to fix infinite Promise loop at end of client.release() in node-postgres?
Here is my code that I'm trying to implement using node-postgres:
return pool.connect().then((client) => {
// if (err) {
// throw err;
// }
let ...
0
votes
1
answer
45
views
Trying to pass a Promise to another function that then returns it, getting "Unhandled promise rejection"
I want to create a generic database update function that I can use to implement more customized update functions. In a module database.js I have the following:
const {Pool,Client}=require('pg');
...
0
votes
1
answer
605
views
node-postgres transaction using in promise chain and all
https://node-postgres.com/features/transactions
I tried to implement some transaction APIs for my project using pg, following the above documentation.
But one thing pops out of my mind, can one ...
0
votes
1
answer
40
views
Why does my Promise return a database row in some cases but not in others?
I have a function in a module db that uses node-postgres to insert a new row into a database:
module.exports={addUser: function(phonenumber){
return new Promise(function(resolve,reject){
...
1
vote
1
answer
3k
views
node-postgres does not show result set for stored procedure
I'm trying to use a stored procedure to create a character. The procedure does some validation to make sure that the params are valid before inserting them into the database(let's keep this validation ...
0
votes
0
answers
460
views
Promise based node-postgres request under Node.js
I'm trying to implement a promise-based approach to accessing a PostgreSQL database. This is the original code:
// ./sql/config/pgQuery.js
module.exports = (text, values, cb) => {
pool.connect((...
6
votes
4
answers
5k
views
Manually promisifying pg.connect with Bluebird
I want to promisify node-postgres' pg.connect method along with the inner connection.query method provided in the callback.
I can .promisify the latter, but I need to implement the first one manually ...