From: Adrian Klaver <adrian.klaver@aklaver.com>
To: David G. Johnston <david.g.johnston@gmail.com>
To: Carl.Weierstrass <carl.weierstrass@googlemail.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: bug or feature
Date: Mon, 5 Oct 2026 07:53:41 -0700
Message-ID: <cc75fdfb-25da-41a3-8fe7-6b5d9966775e@aklaver.com> (raw)
In-Reply-To: <CAKFQuwZqm+d02pJAK0T3xGwds3sFpritkSW1aROjzO+GUGXMaA@mail.gmail.com>
References: <d93e2d28-c230-4c3f-9f46-d1d44fbe46a6@gmail.com>
<CAKFQuwZqm+d02pJAK0T3xGwds3sFpritkSW1aROjzO+GUGXMaA@mail.gmail.com>
On 10/5/26 7:32 AM, David G. Johnston wrote:
> On Monday, October 5, 2026, Carl.Weierstrass
> <carl.weierstrass@googlemail.com
> <mailto:carl.weierstrass@googlemail.com>> wrote:
>
> 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?
>
>
> If you make something up that isn’t documented it shouldn’t work. You
> can call the inability to interpret random stuff you send to the server
> a feature if you need an apply a label.
>
> You might want to look at the WITH clause of those commands to see how
> to go about combining multiple distinct commands into one execution
> correctly.
In particular:
https://www.postgresql.org/docs/current/queries-with.html#QUERIES-WITH-MODIFYING>
> David J.
>
--
Adrian Klaver
adrian.klaver@aklaver.com
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: adrian.klaver@aklaver.com, david.g.johnston@gmail.com, carl.weierstrass@googlemail.com
Subject: Re: bug or feature
In-Reply-To: <cc75fdfb-25da-41a3-8fe7-6b5d9966775e@aklaver.com>
References: <d93e2d28-c230-4c3f-9f46-d1d44fbe46a6@gmail.com> <CAKFQuwZqm+d02pJAK0T3xGwds3sFpritkSW1aROjzO+GUGXMaA@mail.gmail.com> <cc75fdfb-25da-41a3-8fe7-6b5d9966775e@aklaver.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