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

Make my db queries synchronous with with my promise based function

How can I make my db queries synchronous with with my promise base function? In my code, I am running 3 db operations inside 3 different functions which need to be run in order, like waterfall model. The functions are running in waterfall model but…
pkd
  • 504
  • 5
  • 13
0
votes
1 answer

How do I return my data from a function?

I've written a small database function that gets some data from the DB and puts it into the format that I want, but I'm having difficulties returning the data to display it with Express. The database function is as follows: function…
Steve
  • 576
  • 2
  • 7
  • 21
0
votes
1 answer

travis-ci postgres `SELECT EXISTS` query return different result

I am working on some tests with pg-promise involve dropping a table and recreate a table. All tests passes on my local machine. But ontravis-ci, it seems to skipp all the DROP TABLE ... SQL, resulting tests fail. Anyone has any idea why? Is it a…
xiaofan2406
  • 3,250
  • 5
  • 26
  • 34
0
votes
1 answer

Replacing text with data from pg-promise

I would like to replace some text in a string with values from a database using pg-promise. As I have not used Promises before, I'm struggling with how to deal with it in the best way. What I have tried so far doesn't work as I try to combine…
neurotroph
  • 43
  • 6
0
votes
1 answer

error: syntax error at or near "$"

I am currently checking out Vue and am doing a little refactor on a personal project. I am running into some problems with my API. The two technologies involved are axios which I am using to send requests to my API, which talks to a postgres…
Austin Witherow
  • 456
  • 2
  • 4
  • 19
0
votes
1 answer

How do I output postgres node pg results as a table (array of arrays) rather than an array of hashes

I'm using node.js pg-promise module to access a postgres database. It's all working great, except that the results always come back as an array of rows, each of which is a json object with keys and values. It seems wasteful of bandwidth - more…
Zanderman
  • 1
  • 2
0
votes
1 answer

How to chain Postgres query and then GET requests in NodeJS using promises

In my NodeJS app I need to make a query to Postgres and then I need to make GET request for every row in the PG result. And return all GET results in an array. What's wrong with my code? var promise = require('bluebird'); var pgp =…
0
votes
1 answer

Nested conditional promises using pg-promise and bluebird

All I want to do is run a query, check if an email address is already registered and if so reject the request, if not run some validation and then create the user in my users table. This is a bit of a shell, the code was originally based off…
0
votes
0 answers

pg-promise: Transactions: Handling missing properties

This is the query I pass into a batch transaction: INSERT INTO table VALUES(${id}, ${name}, ${crtd}); The input array may or may not contain one of the keys, say ${crtd}. This throws Error: property 'crtd' does not exist and the entire batch…
Harini
  • 41
  • 4
0
votes
1 answer

posting image from ios swift to a postgres database through node.js RestAPI

I am trying to connect my ios app (swift) to a postgres database through RestAPI (using npm and pg-promise) Posting string and integer values worked like a charm, but I am having trouble posting images to the database I am decoding the image into…
Anya Alstreim
  • 133
  • 12
0
votes
1 answer

Difference between pg-promise 'duration' and execution time in EXPLAIN ANALYSE of postgres?

I am using 'duration' property from data object of 'result' function to measure the duration of execution of my query. I tried the same query in pgAdmin with "EXPLAIN ANALYSE". Both have a big difference. can anyone say why is this? which is the…
John
  • 465
  • 2
  • 8
0
votes
0 answers

How to get and propagate data from pg-promise

I have the following entry data: ids = [1,2,3,4] That is an array of ids of dogs and I want query Dog table using pg-routing in order to get the name of all dogs and return a JSON object like following: { "breed": "Chow chow", "dogs": [ …
figuedmundo
  • 375
  • 1
  • 4
  • 15
0
votes
1 answer

Insert with id of type serial in pg-promise

In pg-promise, how can I insert data when the primary key is of type Serial? Omitting the field id creates no response in the call. The code below produces no error in the catch (and also does not execute the then branch). function postSecao(req,…
0
votes
1 answer

Node JS Soap Server(node-soap) passing values from postgres callback

I have a question I am using node-soap and pg-promise. I have a problem where when I make a request to the soap service the response is delayed, in other words I have to send the request twice (using soap ui) before the response comes back: Im…
0
votes
1 answer

Multiple post requests on an event triggered AngularJS app

I am doing a real time app, and in one part of the application, some data is posted to the server when an event is triggered, this is then updated to the db. The problem is each browser connection instance is posting the same data, resulting in…
ashr
  • 299
  • 6
  • 13
1 2 3
34
35