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

From: Dave Cramer <davecramer(at)postgres(dot)rocks>
To: ZhangChi <798604270(at)qq(dot)com>
Cc: Greg Sabino Mullane <htamfids(at)gmail(dot)com>, "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 runningsqlscriptes in JDBC
Date: 2025-12-17 12:55:25
Message-ID: CADK3HH+EK4qM74YVGobr+oWcpe-EFoKGtQDDtt+Yd87nsVeHsQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, 16 Dec 2025 at 20:40, ZhangChi <798604270(at)qq(dot)com> wrote:

> Hi Greg,
>
> Thanks for your reply. I can understand what you describe.
>
> But my question is that in the CLI, the test case (like foo2) I showed can
> return the results. But when I run the same test case in JDBC, the test
> case triggers an error. I wonder why there is an inconsistency.
>
> ```
> SET plan_cache_mode = force_generic_plan;
> CREATE TABLE t0(c0 int4range);
> INSERT INTO t0(c0) VALUES('[-1920846305,-1018839689)'::int4range);
> PREPARE prepare_query (int8, int8) AS SELECT
> ((((((upper(t0.c0))))/($1)))*(($2::int8))) FROM ONLY t0;
> EXECUTE prepare_query(0, NULL); -- trigger error in JDBC but no error in
> CLI
> ```
>

Possibly because JDBC does everything using the V3 protocol whereas psql
does not. psql uses simple query.

Dave Cramer
www.postgres.rocks

>
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Greg Sabino Mullane 2025-12-17 14:51:08 Re: BUG #19350: Short circuit optimization missed when runningsqlscriptes in JDBC
Previous Message PG Bug reporting form 2025-12-17 12:03:44 BUG #19358: Short circuit optimization exists in generic plan but missed in custom plan