Parameterized query strange behaviour #204

daemonfire300 opened this Issue Oct 16, 2012 · 3 comments


2 participants
var query = client.query('INSERT INTO users(username, email, password) VALUES($1, $2, $3)', [user.username,, hash], function(err, result) {
        if (!err) {
            res.send("Created User");
        else {
            res.send("An error occured");

This will insert a user into the db and trigger (!err == true), "Created user" will be displayed.
What I have noticed is, that if you do not assign client.query(...) to var query, nothing will happen.
Is this intended?
And in addition to this, the documentation lacks of proper description of the query() method, it is not clear if my above example is actuall intended to work with:
query(expression, values, callback)

There are no such examples for parametarized queries.


brianc commented Oct 16, 2012

Not assigning the query to var will in no way affect the execution of the query.

Is there a way you can write a completely contained gist, failing test, or example to show the bad behavior?

The documentation seems to have an example of exactly what you're doing on this page under the paramaterized query with optional callback supplied heading

I will overlook it and try to reproduce what I've done.
Well I didn't find this page, because I was going for the Query straight, instead of Client.


brianc commented Dec 11, 2012

any movement on this? You still hitting a wall?

brianc closed this Jan 24, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment