Closed
Description
I'm running a simple test against the latest pg
, under Node.js 8.1.2:
const pg = require('pg');
var client = new pg.Client(connection);
function test() {
client.connect(err => {
if (err) {
console.log(err);
return;
}
client.query('select 123', [], (err, data) => {
if (err) {
console.log(err);
} else {
console.log('DATA:', data.rows[0]);
}
client.end();
});
});
}
setInterval(test, 1000);
And it outputs the following, every time:
DATA: anonymous { '?column?': 123 }
DATA: undefined
DATA: undefined
DATA: undefined
DATA: undefined
DATA: undefined
DATA: undefined
DATA: undefined
events.js:182
throw er; // Unhandled 'error' event
^
error: invalid frontend message type 0
at Connection.parseE (D:\NodeJS\tests\node_modules\pg\lib\connection.js:567:11)
at Connection.parseMessage (D:\NodeJS\tests\node_modules\pg\lib\connection.js:391:17)
at Socket.<anonymous> (D:\NodeJS\tests\node_modules\pg\lib\connection.js:129:22)
at emitOne (events.js:120:20)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:252:12)
at readableAddChunk (_stream_readable.js:239:11)
at Socket.Readable.push (_stream_readable.js:197:10)
at TCP.onread (net.js:588:20)
After I successfully call client.end()
, it will successfully re-connect, successfully execute the query, just won't return any data. This looks odd.
And this - error: invalid frontend message type 0
doesn't make any sense.
Could somebody, please explain, why we get such an odd output?
UPDATE
And if just after creating the client, I add the following:
client.on('error', e => {
console.log(e);
});
The output gets absolutely flooded with a huge error dumb, so big, I can't even paste it here.
Metadata
Metadata
Assignees
Labels
No labels