neondatabase / serverless

Connect to Neon PostgreSQL from serverless/worker/edge functions
https://www.npmjs.com/package/@neondatabase/serverless
MIT License
342 stars 13 forks source link

Dates from generate_series returned as string / different handling than pg does #90

Open joergjaeckel opened 1 month ago

joergjaeckel commented 1 month ago

Hello, I'm not very familiar with how PostgreSQL drivers work and need some advice or confirmation. I've isolated an error that seems to be caused by a Kysely query returning a date as a string in one environment (connect to the DB with @vercel/postgres-kysely which uses this package) and as a date object (connect with pg) in another. Am I right that kysely has nothing to do with data types and just gives me what the driver does? I did not check how timestamp columns are returned, this issue occurs in context of dates generated by generate_series function. Is it desired behaviour to return strings while pg returns date objects? Does this indicate a missing feature or a bug? Maybe someone can look into this. Thank you!

jawj commented 1 month ago

This package makes use of node-postgres (npm install pg) type parsing for everything —  both http (neon) and WebSocket (Client/Pool) queries.

So I would be surprised if this package were responsible for the different return types here: my hypothesis would be that this is on Kysely's side.

But if you can supply a repo containing a minimal reproduction of the issue, I'll be happy to take a look.