| From: | ZhangChi <798604270(at)qq(dot)com> |
|---|---|
| To: | 798604270 <798604270(at)qq(dot)com>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
| Cc: | 798604270 <798604270(at)qq(dot)com> |
| Subject: | Re: BUG #19356: Unexpected result of prepared UPDATE with force_generic_plan |
| Date: | 2025-12-26 06:59:54 |
| Message-ID: | tencent_39F275C07C26D99E494B5C51E8F412CE2E06@qq.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi,
Has anyone had a look at this report?
Best,
Chi
Original
From: PG Bug reporting form <noreply(at)postgresql(dot)org>
Date: 2025-12-16 11:06
To: pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Cc: 798604270 <798604270(at)qq(dot)com>
Subject: BUG #19356: Unexpected result of prepared UPDATE with force_generic_plan
The following bug has been logged on the website:
Bug reference: 19356
Logged by: Chi Zhang
Email address: 798604270(at)qq(dot)com
PostgreSQL version: 17.6
Operating system: ubuntu 24.04 with docker
Description:
Hi,
In the following test case, the WHERE condition of UPDATE is true; however,
the value in the table is not updated:
```
SET plan_cache_mode = force_generic_plan;
CREATE TABLE t2(c0 int4range);
INSERT INTO t2(c0) VALUES('[-1372225904,-410785016)'::int4range) ON CONFLICT
DO NOTHING;
PREPARE prepare_query (text, int4range, text, text, inet) AS UPDATE t2 SET
c0=DEFAULT WHERE NOT (((((CAST($1 AS
int4range))&&(((t2.c0)-($2)))))AND((quote_literal($3) SIMILAR TO
(($4)||($5))))));
EXECUTE prepare_query('-2073583882', '[-1190073754,1650158810)'::int4range,
'?', 'j&Q', '171.191.143.34');
DEALLOCATE prepare_query;
SELECT DISTINCT * FROM t2;
c0
--------------------------
[-1372225904,-410785016)
(1 row)
```
This is the result of the condition:
```
PREPARE prepare_query (text, int4range, text, text, inet) AS SELECT
((((quote_literal($3) SIMILAR TO (($4)||($5))))));
EXECUTE prepare_query('-2073583882', '[-1190073754,1650158810)'::int4range,
'?', 'j&Q', '171.191.143.34');
?column?
----------
f
(1 row)
```
The equivalent normal UPDATE can execute correctly `UPDATE t2 SET c0=DEFAULT
WHERE NOT (((((CAST('-2073583882'::text AS
int4range))&&(((t2.c0)-('[-1190073754,1650158810)'::int4range)))))AND((quote_literal('?'::text)
SIMILAR TO (('j&Q'::text)||('171.191.143.34'::inet))))));`
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tender Wang | 2025-12-26 07:20:58 | Re: BUG #19356: Unexpected result of prepared UPDATE with force_generic_plan |
| Previous Message | Tender Wang | 2025-12-25 04:48:08 | Re: BUG #19355: Attempt to insert data unexpectedly during concurrent update |