-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
NULL for numeric fields -> NaN #26
Comments
I can confirm after work. If this is indeed the case I'll write test & fix the issue tonight. |
I'm GMT+03, what are you (to sync the time window)? Is there a dedicated IRC channel for this project? |
this passes for me: test('selecting null integers', function() {
pg.connect(connectionString, assert.calls(function(err, client) {
client.query("CREATE TEMP TABLE foo(id bigint, num bigint)");
client.query("INSERT INTO foo(id) values(1)");
var q = client.query("SELECT * FROM foo");
assert.emits(q, 'row', function(row) {
assert.equal(row.id, 1);
assert.ok(row.num === null);
})
}))
}) |
Do you use native? If yes, it's a miracle, since I see in the code the use of plain JS |
Rechecked. Right, for JS client it's |
Yeah...that test was passing under native & pure javascript. |
So you can't reproduce it? |
libpq version-dependent may be... |
@dvv are you able to run the test suite locally? If you could run that it would be really helpful. If you need help getting the suite set up (it requires a few records to exist in your test database) you can look here or ask on this thread. Maybe there's something particular to your setup the tests could help shake out? |
|
client.query('insert into "table" ("field") values ($1) returning "id";', [null], function(){});
error for native version, ok for js version |
sorry, I tried null and undefined therefore the error doesn't correspond to parameter in an example :) |
So...@napa3um your code example is indeed throwing an error or not? |
var pg = require('pg').native; var testArg = null; pg.connect("tcp://httpd:374@localhost/node", function(err, client){
}); function errExit(err){ napa3um@hive:~/Workspace/node.js/amedia$ node pg-error.js /home/napa3um/Workspace/node.js/amedia/node_modules/pg/lib/native.js:201 |
one more problem which isn't present in the js-version: // var pg = require('pg'); pg.connect("tcp://httpd:374@localhost/node", function(err, client){
}); napa3um@hive:~/Workspace/node.js/amedia$ node pg-error.js |
Awesome. I've confirmed the issue w/ some unit tests & will work on a patch this evening. Thanks! |
found a fix for this and a few other native related bugs dealing with null values as well....I need to test on various other operating system/postgres combos and then I'll release a new version in npm. thanks again. |
Fixed. |
Add support for TLS parameters in URI
Hi!
On the same setup as in https://gist.github.com/929626 :
...
db.query('select * from foo').on('row', function(row){
console.log(row); // ---> {id: 1, num: NaN}
});
Can you confirm the issue?
TIA,
--Vladimir
The text was updated successfully, but these errors were encountered: