node-postgres/test/integration/gh-issues/882-tests.js
brianc 6f8292435d Respond to emptyQuery with a sync message
When a __prepared statement__ has no body in the query the backend responds with an `emptyQuery` message but never with a `commandComplete` or `errorResponse` message.  The client was hanging forever waiting for one of the other two expected messages.  The server was hanging forever waiting for the client to respond with a `sync` message.  This change has the client send the required `sync` on receipt of an `emptyQuery` message when the query is a prepared statement.  Fixes #822
2015-08-01 18:51:49 -05:00

9 lines
283 B
JavaScript

//client should not hang on an empty query
var helper = require('../test-helper');
var client = helper.client();
client.query({ name: 'foo1', text: null});
client.query({ name: 'foo2', text: ' ' });
client.query({ name: 'foo3', text: '' }, function(err, res) {
client.end();
});