Thread
-
Re: BUG #19350: Short circuit optimization missed when running sqlscriptes in JDBC
Greg Sabino Mullane <htamfids@gmail.com> — 2025-12-16T15:17:08Z
> > I wonder why this query triggers an error under JDBC but not in the CLI. Fails as expected from the command line: prepare foo1 as select 99 / $1::int * $2; PREPARE execute foo1(0, null); ERROR: division by zero prepare foo2 as select 99 / ($1::int * $2); PREPARE execute foo2(0, null); ?column? ---------- ☃ (1 row) prepare foo3 as select (99 / $1::int) * $2; PREPARE execute foo3(0, null); ERROR: division by zero If you want the "null combined with anything = null" to always happen before the "divide by zero is wrong" make your query specific like in foo2 above. Cheers, Greg -- Crunchy Data - https://www.crunchydata.com Enterprise Postgres Software Products & Tech Support