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

nullable timestamptz support (Date | null) #279

Open
timvandam opened this issue Sep 25, 2024 · 1 comment
Open

nullable timestamptz support (Date | null) #279

timvandam opened this issue Sep 25, 2024 · 1 comment

Comments

@timvandam
Copy link

Describe the bug
A clear and concise description of what the bug is.

Currently inserting/updating nullable timestamptz values in postgres don't work. Using variables of type Date | null causes error ESLint: Invalid Query: Unsupported union type(@ts-safeql/ check-sql)

To Reproduce
Steps to reproduce the behavior:

Make a table with a nullable timestamptz column and try to insert a Date | null value

Expected behavior
A clear and concise description of what you expected to happen.

It should work

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • PostgreSQL version [e.g. 13, 14]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

I may have some time to try to fix this over the weekend

@karlhorky
Copy link
Collaborator

@timvandam If you can provide a reproduction in this format with the table schema, sql tag and ESLint error, that would be helpful to understand the problem:

CREATE TABLE users (
  -- ...
)
// 💥 Query has incorrect type annotation.
//	Expected: { has_private_url: boolean; }
//	Actual: { has_private_url: boolean | null; }[]
await sql<{ has_private_url: boolean }[]>`
  SELECT
    ${true} AS has_private_url
  FROM
    users
`;

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

2 participants