Hi David J.
Yes! You are right. I mean, when I run this test case with the wrapper I provide, which executes each SQL statement with JDBC (but without the prepare API of JDBC), then the test case will trigger the error. But if I run it in CLI, for example `psql -U root -W root -p 5433 -h 127.0.0.1 < test.sql`, then there is no error. I do not modify the test caes. But it has different behaviours. I wonder the reason for this discrepancy.
From: David G. Johnston <david.g.johnston@gmail.com> Date: 2025-12-10 21:46 To: ZhangChi <798604270@qq.com> Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org> Subject: Re: BUG #19350: Short circuit optimization missed when running sqlscriptes in JDBC |
On Wednesday, December 10, 2025, ZhangChi <
798604270@qq.com> wrote:
Hi David J.
Thanks for your reply. I wonder why this query triggers an error under JDBC but not in the CLI.
Because the planner can simplify the expression if it sees a constant null value but cannot when everything is injected via parameter.
David J.