Skip to content

Commit

Permalink
fix: treat PostgreSQL's bigint type as String instead of Number (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
uki00a authored Mar 7, 2020
1 parent 8ca39c0 commit b0166ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion decode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ function decodeText(value: Uint8Array, typeOid: number): any {
case Oid.regnamespace:
case Oid.regconfig:
case Oid.regdictionary:
case Oid.int8: // @see https://github.com/buildondata/deno-postgres/issues/91.
return strValue;
case Oid.bool:
return strValue[0] === "t";
case Oid.int2:
case Oid.int4:
case Oid.int8:
return parseInt(strValue, 10);
case Oid.float4:
case Oid.float8:
Expand Down
5 changes: 5 additions & 0 deletions tests/data_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,8 @@ testClient(async function regdictionary() {
const result = await CLIENT.query(`SElECT 'simple'::regdictionary`);
assertEquals(result.rows, [["simple"]]);
});

testClient(async function bigint() {
const result = await CLIENT.query("SELECT 9223372036854775807");
assertEquals(result.rows, [["9223372036854775807"]]);
});

0 comments on commit b0166ce

Please sign in to comment.