Questions tagged [pg-promise]

Complete access layer to node-postgres via Promises/A+.

Built on top of node-postgres and its connection pool, this library translates their callback interface into one based on Promises/A+, while extending the protocol to a higher level, with automated connections and transactions management.

In addition, the library provides:

  • its own, more flexible query formatting;
  • event reporting for connectivity, errors, queries and transactions;
  • declarative approach to controlling query results;
  • support for all popular promise libraries.
521 questions
0
votes
1 answer

UnhandledPromiseRejectionWarning: Error: Property 'password' doesn't exist. pg-promise

I am using pg-promise. I am having an issue trying to insert the following Javascript array: [ { email: 'test1@gmail.com', password: 'test2' }, { email: 'tes2t@gmx.com', password: 'test'3 }, { email: 'test4@gmail.com', password: 'test4' }, {…
Sledro
  • 127
  • 1
  • 12
0
votes
1 answer

Trouble accessing data from a joined sql table in express

I'm using express and postgreSQL to create an api that shows restaurant ratings, reviews and cuisine in given areas. So far I have managed to create routes and controllers that will display the sql tables in postman. However my issue occurs when…
Tim Dowd
  • 205
  • 4
  • 12
0
votes
1 answer

Sharing a pg-promise task across parts of an http request

I am using pg-promise in a GraphQL application and because of the nested/iterative nature of the resolvers each HTTP request makes a lot of database queries. So I am wondering is there is a more effective way to share a connection from the…
Dan Fairaizl
  • 2,172
  • 2
  • 28
  • 31
0
votes
1 answer

Signup, UnhandledPromiseRejectionWarning, UnhandledPromiseRejectionWarning: QueryResultError: 0, DeprecationWarning

Hello I'm having trouble trying to figure out why I keep getting this long error message. I'm trying to create a simple signup function using Node.js, pg-promise with a postgreSQL Database. (node:79941) UnhandledPromiseRejectionWarning:…
AJH
  • 3
  • 1
  • 3
0
votes
0 answers

Is it possible to create table and schema using pg-promise nodejs?

Am trying to bulk import using the below code in node js but before that, I need to create a table. const cs = new pgp.helpers.ColumnSet(['incdt_crte_by_i', 'incdt_asgn_to_i'], {table: 'incdt'}); // data input values: const values =…
punith bp
  • 174
  • 1
  • 12
0
votes
1 answer

Nodejs converts database time to UTC format without actually converting the date

In My database, I have following values for a column: created_at: 2018-11-29 00:24:33.967124 But when I query this column to get its data in nodeJS, it returns following data: created_at: 2018-11-29T00:24:33.967124Z I do not know who is the culprit…
undefined
  • 3,464
  • 11
  • 48
  • 90
0
votes
0 answers

Working SQL produces type and syntax errors with Node and pg-promise

I'm working with Node and Express, and using the pg-promise library to interact with my Postgres database. I have many queries set up and they all work fine. I have written a query no different than the rest that works when tested out in the…
Ryan Murray
  • 175
  • 2
  • 7
0
votes
1 answer

DOTENV not reading variables properly

This is my file: postgresU="myuser" postgresP="mypass" postgresH="myhost" postgresDB="mydb" postgresC="postgres://${postgresU}:{$postgresP}@{$postgresH}:5432/${postgresDB}" In my nodejs app, require('dotenv').config(); var connectionString =…
0
votes
0 answers

Speed-up query by decreasing duration time

I use pg-promise to query a postgis database containing rasters. Queries are strings (with no parameters) generated before being processed by pg-promise. The duration time of one query is typically 140ms (given by result function), while only 15ms…
Guillaume
  • 53
  • 7
0
votes
0 answers

Syntax Problem in Parameterized Query Using pg-promise and node.js

I've been working on a project with nodejs and pg-promise. Couldn't quite figure out how to implement parameterized query. Here how my code looks like: // let's say we have an array var hex = new Array; hex = [[0, 1, 2, 'string1', 3,…
0
votes
2 answers

Complete SQL before return from constructor

I am using pg-promise: class Test{ constructor(){ this.a = db.any('SELECT * FROM test'); } } If I call test.a, it will return Promise { } }. How do I handle this problem? I cannot use .then() to solve this problem, because…
SinLok
  • 589
  • 1
  • 5
  • 19
0
votes
0 answers

Pg-promise - How to stream binary data directly to response

Forgive me I'm still learning. I'm trying to download some mp3 files that I have stored in a table. I can download files directly from the file system like this: if (fs.existsSync(filename)) { res.setHeader('Content-disposition', 'attachment;…
Coco
  • 1,550
  • 3
  • 24
  • 43
0
votes
1 answer

Store list of wkt inside an object by pg-promise in nodejs

I want to store this object into postgresql by nodejs and pg-promise library : This is my method: saveLineIntoDb({ 'line': linesGeoJson, 'date': user[i].date_created, 'user_id': user[i].uid, 'device_id':…
Cyrus the Great
  • 5,145
  • 5
  • 68
  • 149
0
votes
2 answers

Hundreds of indexes created automatically

I created a table which is used for storing information relative to resources of different kind, the table description prints 250 indexes for each foreign key, is this behavior normal? The table contains only 50 rows. CREATE TABLE IF NOT EXISTS…
Fruff
  • 47
  • 6
0
votes
1 answer

node js Master Slave replication with read and write queries split up

My application runs on node js and using PostgreSQL(pg-promise) for the database connection. I want that all write queries should go to master instances of DB and read queries to slave instance. I have set up the server configuration…