2

I am working with the pg module for node. I am trying to get some rows from different tables. Often times i get an error in my tests when accessing rows because the query came back empty. In that case i would like to get the query with parameters inserted in the console so i can paste it to pgAdmin and see what is wrong easier.

I tried searching for it in the pg docs but couldnt find anything.

Is there a way to output the queries?

1

1 Answer 1

4

Thanks to Vitaly's comment and his library pg-promise I was able to print out the statements like described by him in this answer:

get executable query from query with parameters

Thank you Vitaly.

Sign up to request clarification or add additional context in comments.

1 Comment

Since you are developing for Node.js + PostgreSQL, you can switch over to pg-promise completely, and not just for query formatting ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.