Open RyanDurk opened 1 year ago
Postgres gives a syntax error if you try to run SELECT IN with an empty array:
select *
from generate_series(1, 5) i
where i not in ();
[42601] ERROR: syntax error at or near ")" Position: 55
Postgres gives a syntax error if you try to run SELECT IN with an empty array:
select * from generate_series(1, 5) i where i not in (); [42601] ERROR: syntax error at or near ")" Position: 55
Just to clarify, postgres does. Postgresjs does not, and instead returns an empty array for that query. Which is the issue.
Hi @RyanDurk .. Yeah, it might be a bit too magical that Postgres.js sends (null)
if the array is empty. It's something to consider changing with v4 since it's breaking. I'm not sure if it should go, or if the behaviour should simply be documented better. What do you think?
The behavior is even more surprising with bulk inserts. It just hangs when the array is empty.
@sk-shishi that sounds like a different issue. Could you post more details?
The sql call below returns an empty array to the rows variable. I'm not sure how the query is being translated exactly (is there a way to see the generated query?) but I think throwing would be more useful than gracefully returning an empty array.