-
-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Describe the bug
A clear and concise description of what the bug is.
Getting error ESLint: Invalid Query: Union types must be of the same type (found unknown (524288), unknown (524288), unknown (524288), unknown (524288))(@ts-safeql/ check-sql).
These are clearly the same type, in postgres at least. The issue is happening when trying to insert using unnest to a column that takes TEXT.
To keep things short:
(SELECT name, "durationMs"
FROM UNNEST(${name} :: text[], ${timeoutMs} :: int[]) AS t(name, "durationMs"))Where name has type:
const name: "load-steam-inventory"[] | "load-steam-price"[] | "verify-email-address"[] | "test"[]If I update this type to:
(
| 'load-steam-inventory'
| 'load-steam-price'
| 'verify-email-address'
| 'test'
)[]It does work. However I don't have control over that as the variable is the output of a function
To Reproduce
Steps to reproduce the behavior:
Try inserting many values to a TEXT column using UNNEST with an array with a similar type as mine
Expected behavior
A clear and concise description of what you expected to happen.
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.
May have time to look into this myself this weekend