Skip to content

insufficient data left in message #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wavded opened this issue Jul 20, 2011 · 14 comments
Closed

insufficient data left in message #39

wavded opened this issue Jul 20, 2011 · 14 comments

Comments

@wavded
Copy link

wavded commented Jul 20, 2011

between either the upgrade to Node v0.4.10 or the upgrade to the latest pg module now gives me this error for any prepared statement:

{ length: 88,
  name: 'error',
  severity: 'ERROR',
  code: '08P01',
  message: 'insufficient data left in message',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  file: 'pqformat.c',
  line: '629',
  routine: 'pq_copymsgbytes' }
@brianc
Copy link
Owner

brianc commented Jul 20, 2011

I need version of postgres, operating system, and simple code I can run to reproduce the error. Also, are you using the native driver or the pure javascript flavor?

@wavded
Copy link
Author

wavded commented Jul 20, 2011

looks like its the latest node that broke it, i'm using the javascript (the default) flavor, ubuntu 11.04, postgres 8.3 and i'll get you some code..

@wavded
Copy link
Author

wavded commented Jul 20, 2011

        client.query({
            text: "SELECT * FROM users WHERE username = $1 and password = $2",
            values: ['user', 'password']
        },function(err, result){
            if(err) error(err);
            // do stuff
        });

need more?

@brianc
Copy link
Owner

brianc commented Jul 20, 2011

no, just upgraded to v0.4.10 and tests are failing all over the place. not happy.

@wavded
Copy link
Author

wavded commented Jul 20, 2011

ok, yeah that sucks, wonder what changed

@brianc
Copy link
Owner

brianc commented Jul 20, 2011

dunno...debugging it now. any help would be appreciated. Not even the unit tests (those which do not need postgres) are passing. has to do w/ buffer changes, but haven't pinpointed it

@brianc
Copy link
Owner

brianc commented Jul 20, 2011

hop on #node.js if you want to discuss

@brianc
Copy link
Owner

brianc commented Jul 20, 2011

found a fix, patching soon

@wavded
Copy link
Author

wavded commented Jul 20, 2011

great! good work!

@brianc brianc closed this as completed in c317606 Jul 20, 2011
@wavded
Copy link
Author

wavded commented Jul 20, 2011

working great, thx!

@polotek
Copy link

polotek commented Nov 16, 2011

We ran into this same error and are trying to track it down. We're using node 0.4.12 and we've certainly been using recent versions of pg with this fix. Can you give a little more info about why this happens and we might try reproducing it in our environment?

node 0.4.12
pg 0.5.7 - js client
postgres 9.0.4

@brianc
Copy link
Owner

brianc commented Nov 16, 2011

Hey @polotek. Sure thing...

The issue was caused by a change in the signature to buffer.write. I patched node-postgres on November 1st with a fix for this issue.

var writeString = function(buffer, string, offset, len) {

I would recommend upgrading pg to the latest version (I believe the fix is included in pg@0.6.5) unless you have a strong reason not to.

@brianc
Copy link
Owner

brianc commented Nov 16, 2011

To elaborate further...the buffer.write null terminated string encoding changed. Here is the issue in which I introduced the patch.

#63

Bug introduced by this node patch

nodejs/node-v0.x-archive@6a72e52

Which, incidentally was introduced to close this issue I submitted almost a year ago:

nodejs/node-v0.x-archive#394

@polotek
Copy link

polotek commented Nov 17, 2011

Ah, yes the other ticket is more recent. I was just looking at the dating of this ticket. Will update accordingly. Thanks. pg has been working very well for us.

brianc pushed a commit that referenced this issue Dec 27, 2019
This matches the proposed way in "bring your own promise".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants