Re: BUG #19350: Short circuit optimization missed when runningsqlscriptes in JDBC
| От | Dave Cramer |
|---|---|
| Тема | Re: BUG #19350: Short circuit optimization missed when runningsqlscriptes in JDBC |
| Дата | |
| Msg-id | CADK3HHJgaeXW1+TO9DObZsv3nryujJMzAqYZFFM-S5vcsP5w4A@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: BUG #19350: Short circuit optimization missed when runningsqlscriptes in JDBC (Dave Cramer <davecramer@postgres.rocks>) |
| Список | pgsql-bugs |
Dave Cramer
www.postgres.rocks
On Wed, 17 Dec 2025 at 10:33, Dave Cramer <davecramer@postgres.rocks> wrote:
On Wed, 17 Dec 2025 at 09:51, Greg Sabino Mullane <htamfids@gmail.com> wrote:Possibly because JDBC does everything using the V3 protocol whereas psql does not. psql uses simple query.Maybe JDBC is doing something else? I cannot duplicate the error when doing it via the protocol (DBD::Pg) or via psql. Even forcing non-server-side prepares (i.e. making the driver replace the vars itself) fails to fail.Logs from the server. I can replicate it.2025-12-17 10:31:07.860 EST [27985] LOG: duration: 5.875 ms statement: SET application_name = 'PostgreSQL JDBC Driver'
2025-12-17 10:31:07.880 EST [27985] LOG: duration: 0.945 ms parse <unnamed>: SET plan_cache_mode = force_generic_plan
2025-12-17 10:31:07.880 EST [27985] LOG: duration: 0.057 ms bind <unnamed>: SET plan_cache_mode = force_generic_plan
2025-12-17 10:31:07.880 EST [27985] LOG: duration: 0.019 ms execute <unnamed>: SET plan_cache_mode = force_generic_plan
2025-12-17 10:31:07.885 EST [27985] LOG: duration: 3.442 ms parse <unnamed>: CREATE TABLE t0(c0 int4range)
2025-12-17 10:31:07.885 EST [27985] LOG: duration: 0.023 ms bind <unnamed>: CREATE TABLE t0(c0 int4range)
2025-12-17 10:31:07.939 EST [27985] LOG: duration: 54.701 ms execute <unnamed>: CREATE TABLE t0(c0 int4range)
2025-12-17 10:31:07.944 EST [27985] LOG: duration: 2.667 ms parse <unnamed>: INSERT INTO t0(c0) VALUES('[-1920846305,-1018839689)'::int4range)
2025-12-17 10:31:07.945 EST [27985] LOG: duration: 0.695 ms bind <unnamed>: INSERT INTO t0(c0) VALUES('[-1920846305,-1018839689)'::int4range)
2025-12-17 10:31:07.946 EST [27985] LOG: duration: 1.593 ms execute <unnamed>: INSERT INTO t0(c0) VALUES('[-1920846305,-1018839689)'::int4range)
2025-12-17 10:31:07.947 EST [27985] LOG: duration: 0.311 ms parse <unnamed>: PREPARE prepare_query (int8, int8) AS SELECT ((((((upper(t0.c0))))/($1)))*(($2::int8))) FROM ONLY t0
2025-12-17 10:31:07.947 EST [27985] LOG: duration: 0.006 ms bind <unnamed>: PREPARE prepare_query (int8, int8) AS SELECT ((((((upper(t0.c0))))/($1)))*(($2::int8))) FROM ONLY t0
2025-12-17 10:31:07.952 EST [27985] LOG: duration: 4.653 ms execute <unnamed>: PREPARE prepare_query (int8, int8) AS SELECT ((((((upper(t0.c0))))/($1)))*(($2::int8))) FROM ONLY t0
2025-12-17 10:31:07.953 EST [27985] LOG: duration: 0.020 ms parse <unnamed>: EXECUTE prepare_query(0, NULL)
2025-12-17 10:31:07.953 EST [27985] LOG: duration: 0.005 ms bind <unnamed>: EXECUTE prepare_query(0, NULL)2025-12-17 10:31:07.954 EST [27985] ERROR: division by zero
I also get the division by zero error with psql
SET
CREATE TABLE
INSERT 0 1
PREPARE
psql:/Users/davecra/projects/jdbc/testjdbc/test.sql:5: ERROR: division by zero
?column?
----------
(1 row)
Dave Cramerwww.postgres.rocks
В списке pgsql-bugs по дате отправления: