You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is something wrong with the array parser in pg. It works great when postgres returns strings or integers, but it breaks when pg returns floats.
Try the following example:
varpg=require('pg'),db='pg://user:pass@localhost/db',sql='SELECT array_agg(column1) AS foo FROM (VALUES(1.),(2.),(3.)) AS bar';pg.connect(db,function(err,client){client.query(sql,function(err,result){varfoo=result.rows[0].foo;console.log(foo);console.log(foo[0]);console.log(foo[1]);console.log(foo[2]);});});
I would expect this result:
[ 1, 2, 3 ]
1
2
3
but I actually get this result:
{1,2,3}
{
1
,
pg is obviously returning the array as a string, not an array. Note that the above example works fine if you use integers or strings in the VALUES clause. It just fails for floats.
The text was updated successfully, but these errors were encountered:
There is something wrong with the array parser in pg. It works great when postgres returns strings or integers, but it breaks when pg returns floats.
Try the following example:
I would expect this result:
but I actually get this result:
pg is obviously returning the array as a string, not an array. Note that the above example works fine if you use integers or strings in the VALUES clause. It just fails for floats.
The text was updated successfully, but these errors were encountered: