From: Carl.Weierstrass <carl.weierstrass@googlemail.com>
To: pgsql-general@lists.postgresql.org
Subject: bug or feature
Date: Mon, 5 Oct 2026 10:26:55 +0200
Message-ID: <d93e2d28-c230-4c3f-9f46-d1d44fbe46a6@gmail.com> (raw)
Hi,
I want to delete some data from table test1 und protocol the deleted
data in table test2:
The solution with two statements
begin;
insert into test2
select * from test1
where 1 = 1;
delete from test1
where 1 = 1
returning *; -- show deleted lines
commit;
works fine, but the more elegant version in one single statement results
in a syntax error
begin;
insert into test2
delete from test1
where 1 = 1
returning *; --return deleted lines
commit;
psql:test.sql:32: FEHLER: Syntaxfehler bei »delete«
ZEILE 2: delete from test1
Is this a bug or a feature?
Charly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: carl.weierstrass@googlemail.com
Subject: Re: bug or feature
In-Reply-To: <d93e2d28-c230-4c3f-9f46-d1d44fbe46a6@gmail.com>
References: <d93e2d28-c230-4c3f-9f46-d1d44fbe46a6@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox