NeonN
Neon10mo ago
2 replies
awake-maroon

Yep, but it looks like that's not the

Yep, but it looks like that's not the right OID for _int8:

const { neon, types } = await import('@neondatabase/serverless');
const sql = neon('postgresql://...');

types.setTypeParser(types.builtins.INT8, int8 => `int8:${int8}`);
console.log(await sql`SELECT '1'::int8`);

const [{ oid: int8oid }] = await sql`SELECT oid FROM pg_type WHERE typname = '_int8'`;
console.log({ int8oid });

types.setTypeParser(int8oid, int8 => `int8[]:${int8}`);
console.log(await sql`SELECT '{1, 2, 3}'::int8[]`);


Which produces:

[ { int8: 'int8:1' } ]
{ int8oid: 1016 }
[ { int8: 'int8[]:{1,2,3}' } ]
Was this page helpful?