Skip to content

"invalid message format" error when string to write contains a NUL character #10

Closed
@rchampeimont

Description

@rchampeimont

When I send a string with a \0 in it, I get an "invalid message format" error.

var sql = require('sql-bricks-postgres');

// pool is the "pool" object provided by module pg 6.1.0
pool.connect(function(error, client, done) {
  if (error) return console.error(error.stack);

  client.query(sql.insertInto('test', 's').values('test\0').toString(), function(error, result) {
    if (error) return console.error(error.stack);
  });
});

I get:

error: invalid message format
at Connection.parseE (/Users/raphaelchampeimont/nodejs-doctrine/node_modules/pg/lib/connection.js:554:11)
at Connection.parseMessage (/Users/raphaelchampeimont/nodejs-doctrine/node_modules/pg/lib/connection.js:381:17)
at TLSSocket. (/Users/raphaelchampeimont/nodejs-doctrine/node_modules/pg/lib/connection.js:117:22)
at emitOne (events.js:77:13)
at TLSSocket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:153:18)
at TLSSocket.Readable.push (_stream_readable.js:111:10)
at TLSWrap.onread (net.js:536:20)

I am using sql-bricks-postgres@0.4.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions