Saturday 30 March 2019

Help with promise-pg (or node-pg)

Hi,I'm hoping someone can help me. I was getting error with that I am unable to insert since the query has multiple commands (1st command is to go to the schema 'set_path= "schema"; then INSERT ....)so far I am not sure how to properly do it, I tried many different commands and right now with the code below I am not getting errors (I get SUCCESSS) but it is not inserting in the db, any idea or help either with promise-pg or node-pg?! thank you in advance!! db.none('SET search_path = "schema"') .then(t => { 'SET search_path = "schema"; INSERT INTO table_name (attr1, attr2, attr3) VALUES ($1, $2, $3);', [attr1, attr2, attr3]; }) .then(t => { console.log('SUCCESSS '); }) .catch(error => { console.log('ERROR!!!!', error); }); EDIT: I should mention the the value I'm inserting are generated (fakes) so it's not fixed, I need this to fill the db with data

Submitted March 30, 2019 at 09:20PM by pompeii-eo

No comments:

Post a Comment