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

From: ZhangChi <798604270(at)qq(dot)com>
To: David G(dot) Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19350: Short circuit optimization missed when running sqlscriptes in JDBC
Date: 2025-12-10 13:41:12
Message-ID: tencent_6A625E6BCFAF916999E0C64185022D99ED0A@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi David J.

Thanks for your reply. I wonder why this query triggers an error under JDBC but not in the CLI.

Original


From: David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com&gt;
Date: 2025-12-10 21:33
To: 798604270(at)qq(dot)com <798604270(at)qq(dot)com&gt;, pgsql-bugs(at)lists(dot)postgresql(dot)org <pgsql-bugs(at)lists(dot)postgresql(dot)org&gt;
Subject: Re: BUG #19350: Short circuit optimization missed when running sqlscriptes in JDBC

On Wednesday, December 10, 2025, PG Bug reporting form <noreply(at)postgresql(dot)org&gt; wrote:
The following bug has been logged on the website:

Bug reference:&nbsp; &nbsp; &nbsp; 19350
Logged by:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Chi Zhang
Email address:&nbsp; &nbsp; &nbsp; 798604270(at)qq(dot)com
PostgreSQL version: 17.6
Operating system:&nbsp; &nbsp;ubuntu 24.04 with docker
Description:&nbsp; &nbsp; &nbsp; &nbsp;

Hi,

In the following test case, if I run it in JDBC, the prepared statement will
trigger a divide by zero error. But if run it in command line, there will
not be the same error.

This isn’t a bug in PostgreSQL, it’s a bug in the query you’ve written.&nbsp; The expectation of short-circuiting is flawed - the non-failure outcome is not something than can be relied upon.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2025-12-10 13:46:51 Re: BUG #19350: Short circuit optimization missed when running sql scriptes in JDBC
Previous Message David G. Johnston 2025-12-10 13:33:15 Re: BUG #19350: Short circuit optimization missed when running sql scriptes in JDBC