pg-promise Questions

1

I want to setup a connection to a PostgreDB in a server plugin so that I can use it whenever needed (I use pg-promise because I find named parameters more convenient). In ~/server/plugins/connectdb...
Gujarat asked 6/1 at 17:34

4

Solved

I've got an API up on node using pg-promise for Postgres, this works well but i'm thinking about how to modify the PUT statement to handle NULLS in the input a little better. The following is the...
Ashliashlie asked 19/11, 2016 at 20:1

3

Solved

I would like to insert multiple rows with a single INSERT query, for example: INSERT INTO tmp(col_a,col_b) VALUES('a1','b1'),('a2','b2')... Is there a way to do this easily, preferably for an ar...
Tamera asked 18/5, 2016 at 13:24

1

Solved

Node v14, server backend needs Observable and connection to PostgreSql. To create Observable, import { Observable } from 'rxjs'; is needed. Must add "type": "module" into pakag...
Hyperopia asked 24/8, 2021 at 0:9

4

Solved

I have this simple query to a table that contains a column of type bigint. However when I query it, pg-promise returns this column's values as a string. I can't find info about that in the docume...
Serrano asked 26/8, 2016 at 14:19

2

Solved

I am building an express application that connects to a postgres database using the pg-promise module. I would like to ensure that the database connection is successful when starting the applicati...
Erma asked 20/3, 2016 at 22:29

0

Pg-promise is Not returning anything for 60s and gets timed out while running server setup with express-generator. There are no error messages. All the routes without db.any or similar query, works...
Nevis asked 4/12, 2020 at 23:10

2

Solved

I need to close a PG-Promise database connection after testing a function in Jest. This is initialised in one place(db.js) and required everywhere it is needed. In the case of the code below, it i...
Thoer asked 20/8, 2018 at 1:36

1

Solved

We recently moved to Heroku and upon attempting to connect our apps to the DB, it kept rejecting our queries with the message "Self signed certificate". Passing in rejectUnauthorized solv...
Eligible asked 12/9, 2020 at 18:25

1

Solved

I am trying to insert multiple rows to pgsql database using pg-promise. In my case, few records, which I am trying to insert, may exist already in the table. In such case, I need to update them. By...
Sonnie asked 9/8, 2020 at 14:30

3

Solved

I am trying to set up a Postgres database in a nodejs server using ES6 syntax, but I don't think I'm importing and initializing pg-promise properly. If I were using common js sytax I would do the b...
Airdry asked 1/7, 2020 at 4:46

4

Solved

I need to build a function for processing large CSV files for use in a bluebird.map() call. Given the potential sizes of the file, I'd like to use streaming. This function should accept a stream (...
Kilogram asked 14/10, 2015 at 15:35

1

Solved

The error: duplicate key value violates unique constraint "users_pkey" I am using Node and PG-Promise I am bulk inserting a bunk of data into my database. Sometimes, the data already exists so I ...
Captivate asked 23/1, 2020 at 20:11

1

I want to implement an UPDATE SET statement with named parameters? Is it possible? For an object like: { _id: 1, name: "new_name", password: "new_password", subscribed: true, email: "[email&...
Xylo asked 29/12, 2019 at 6:53

1

Solved

We can set 2 timeouts for the Client: statement_timeout: number of milliseconds before a statement in query will time out, default is no timeout query_timeout number of milliseconds before a quer...
Shrovetide asked 3/12, 2019 at 10:59

1

Solved

Given a table with a column of type jsonb[], how do I insert a json array into the column? Using the provided formatters :array, :json won't work in this instance - unless I am missing the correc...
Expecting asked 7/11, 2019 at 23:19

4

Solved

I have read several times the documentation provided at : Node API Babel 6 Docs I'm starting out learning pg-promise following the Learn by Example tutorial and would prefer to work with ES6 and t...
Eozoic asked 10/11, 2015 at 6:23

3

Solved

I'm new to node(express) and pg-promise, and have not been able to figure out how to add the result of each nested query(loop) into the main json array result query. I have two tables: Posts and c...
Synge asked 17/5, 2018 at 12:37

1

Solved

I am trying to run the query: let query = ` DELETE FROM ${table_name} WHERE _id IN ($1::bigint[]) AND account_id = $2 ` let fields = [ _ids, account_id, ] but it's giving me the erro...
Worrisome asked 9/2, 2019 at 21:55

2

Solved

I have following table: CREATE TABLE IF NOT EXISTS categories ( id SERIAL PRIMARY KEY, title CHARACTER VARYING(100) NOT NULL, description CHARACTER VARYING(200) NULL, category_type CHARACTER V...
Bat asked 21/12, 2018 at 17:7

1

I am currently using the database class from http://vitaly-t.github.io/pg-promise/Database.html and trying to implement an Update statement using a PreparedStatment on my Postgres DB while having a...
Diannadianne asked 13/11, 2018 at 11:44

2

Solved

My question is based on Combine nested loop queries to parent array result - pg-promise. I'm having a similar scenario but have multiple queries to be combined to get my final results. Following is...
Aversion asked 23/7, 2018 at 10:19

0

I am creating code using just the pg module, where I have a general function for executing queries. This function can create a client on the spot if it doesn't take an already existing client as an...
Cyclostome asked 4/6, 2018 at 13:56

1

Solved

Question is: 1) Can pg-promise be used to create a new database (schemas, et. al.)? Using node package 'pg-promise' I can't seem to figure out if it's possible to create a new database. I can c...
Dockage asked 11/3, 2018 at 21:32

2

Solved

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)'...
Cahier asked 9/3, 2018 at 6:50

© 2022 - 2024 — McMap. All rights reserved.