| From: | surya poondla <suryapoondla4(at)gmail(dot)com> |
|---|---|
| To: | 303677365(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #19463: Server crash (Assertion failure) when using MERGE statement in CTE |
| Date: | 2026-04-27 22:31:27 |
| Message-ID: | CAOVWO5pvxWGTr_YTFd6=kvCLk_4Jpaj13gNBY=NJZ9BTh+ounw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi Chunling,
Thank you for reporting the issue.
I tried to reproduce the issue on postgres19 and I don't see any crash.
psql (19devel)
Type "help" for help.
postgres=#
postgres=#
postgres=#
postgres=# CREATE TABLE target (col_int INT, col_varchar VARCHAR(2000));
CREATE TABLE
postgres=# CREATE TABLE source (col_int INT, col_varchar VARCHAR(2000));
CREATE TABLE
postgres=# INSERT INTO source VALUES (1, 'test');
INSERT 0 1
postgres=#
postgres=#
postgres=# WITH merge_cte AS (
postgres(# MERGE INTO target t
postgres(# USING source s ON t.col_int = s.col_int
postgres(# WHEN NOT MATCHED THEN INSERT (col_int, col_varchar) VALUES
WHEN NOT MATCHED THEN INSERT (col_int, col_varchar) VALUES (s.col_int,
postgres(# s.col_varchar)
postgres(# )
postgres-# SELECT col_int FROM merge_cte;
ERROR: WITH query "merge_cte" does not have a RETURNING clause
LINE 7: SELECT col_int FROM merge_cte;
^
postgres=# WITH merge_cte AS (
postgres(# MERGE INTO target t
postgres(# USING source s ON t.col_int = s.col_int
postgres(# WHEN NOT MATCHED THEN INSERT (col_int, col_varchar) VALUES
(s.col_int, s.col_varchar) RETURNING t.col_int
postgres(# )
postgres-# SELECT col_int FROM merge_cte;
col_int
---------
1
(1 row)
I tried to reproduce the issue on postgres15 too, but i see ERROR: MERGE
not supported in WITH query.
Regards,
Surya Poondla
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Christophe Pettus | 2026-04-27 22:51:12 | Re: uuidv7 improperly accepts dates before 1970-01-01 |
| Previous Message | Tom Lane | 2026-04-27 14:08:37 | Re: BUG #19467: Inconsistency in MOD() result involving POWER() and floating-point precision in PostgreSQL |