From: easteregg@verfriemelt.org
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Subject: Re: plpgsql variable assignment not supporting distinct anymore
Date: Fri, 22 Jan 2021 14:41:06 +0100
Message-ID: <20210122134106.e94c5cd7@mail.verfriemelt.org> (raw)
the code provided is just a little poc to get the error ( which i have not included with my first mail sorry. )
ERROR: syntax error at or near "DISTINCT"
LINE 8: _test := DISTINCT a FROM ( VALUES ( (true), ( true ) ) )...
the code in production looked like this:
_resource_id :=
DISTINCT ti_resource_id
FROM tabk.resource_timeline
WHERE ti_a2_id = _ab2_id
AND ti_type = 'task'
;
this is backed up by a trigger function, that will ensure to every instance with the same ti_a2_id exists only one ti_resource_id, hence the query can never fail due to more than one row beeing returned. but this syntax is not supported anymore, which will break BC. up until PG 13, the assignment statement was just an implizit SELECT <expression> Query.
Since Tom Lane didn't mentioned this change in the other thread, i figured the devteam might not be aware of this chance.
i can refactor this line into
_resource_id :=
ti_resource_id
FROM tabk.resource_timeline
WHERE ti_a2_id = _ab2_id
AND ti_type = 'task'
GROUP BY ti_resource_id
;
but concerns about BC was already raised, although with UNION there might be far less people affected.
with kind regards, richard
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: easteregg@verfriemelt.org, pgsql-hackers@lists.postgresql.org, tgl@sss.pgh.pa.us, pavel.stehule@gmail.com
Subject: Re: plpgsql variable assignment not supporting distinct anymore
In-Reply-To: <20210122134106.e94c5cd7@mail.verfriemelt.org>
* 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