Re: BUG #19350: Short circuit optimization missed when running sqlscriptes in JDBC

Поиск
Список
Период
Сортировка
От ZhangChi
Тема Re: BUG #19350: Short circuit optimization missed when running sqlscriptes in JDBC
Дата
Msg-id tencent_95746975D7E33A69DE8B0CD8642AAE343405@qq.com
обсуждение исходный текст
Ответ на Re: BUG #19350: Short circuit optimization missed when running sql scriptes in JDBC  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: BUG #19350: Short circuit optimization missed when running sqlscriptes in JDBC
Список pgsql-bugs
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.


Original

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. 

В списке pgsql-bugs по дате отправления: