Open darkgnotic opened 3 months ago
Using postgres({types: {bigint: postgres.BigInt}}) I am able to read both int8 and int8[] values as bigints.
postgres({types: {bigint: postgres.BigInt}})
int8
int8[]
bigint
I can also input values using string[] parameters for the latter. However, I get a failure when attempting to use a bigint[] as a parameter.
string[]
bigint[]
await sql`CREATE TABLE foo(big int8, bigs int8[])`; await sql`INSERT INTO foo ${sql({big: 9007199254740993n})}`; expect((await sql`SELECT * FROM foo`)[0]).toEqual({ big: 9007199254740993n, bigs: null, }); await sql`INSERT INTO foo ${sql({bigs: ['9007199254740993']})}`; expect((await sql`SELECT * FROM foo`)[1]).toEqual({ big: null, bigs: [9007199254740993n], }); // Fails with: // PostgresError: column "bigs" is of type bigint[] but expression is of type bigint await sql`INSERT INTO foo ${sql({bigs: [9007199254740994n]})}`; expect((await sql`SELECT * FROM foo`)[2]).toEqual({ big: null, bigs: [9007199254740994n], });
Is there something more that I have to configure to be able to input bigint[] parameters?
Thank you for your help!
Using
postgres({types: {bigint: postgres.BigInt}})
I am able to read bothint8
andint8[]
values asbigint
s.I can also input values using
string[]
parameters for the latter. However, I get a failure when attempting to use abigint[]
as a parameter.Is there something more that I have to configure to be able to input
bigint[]
parameters?Thank you for your help!