Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
joergjaeckel opened this issue Aug 22, 2024 · 2 comments

Comments

@joergjaeckel
Copy link

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
Copy link
Collaborator

jawj commented Aug 28, 2024

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.

@vincenzorm117
Copy link

Im having the same issue.

  • Local - On my local, I am using Pool's from the pg package, and the dates get converted to JS Date objects.
  • Prod - In production, I am using neon's Pool's and those return as strings.

From vercel/storage#635, I found that there is an object where you set how the driver parses and serializes the data but those don't appear to work for neon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants