Thread

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

    Dave Cramer <davecramer@postgres.rocks> — 2025-12-17T12:55:25Z

    On Tue, 16 Dec 2025 at 20:40, ZhangChi <798604270@qq.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
    
    >
    >