From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: jorge@jrg.com.br
Subject: BUG #17259: RETURN QUERY no longer accepts an UPDATE RETURNING
Date: Sun, 31 Oct 2021 01:11:32 +0000
Message-ID: <17259-fc4d4f2e6924cc42@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17259
Logged by: Jorge Gualtieri
Email address: jorge@jrg.com.br
PostgreSQL version: 14.0
Operating system: Ubuntu 20.04.3 LTS
Description:
In version 14.0 RETURN QUERY with UPDATE RETURNING in a function is
reporting an error and it works in version 13.4.
Test code:
--
create table test (i int primary key, j int);
insert into test values (1,1);
create or replace function f_test() returns setof int
language plpgsql
as $fn$
begin
return query
update test
set j = j+1
where i = 1
returning j;
end;
$fn$;
select * from f_test();
--
ERROR: 42601: query is not a SELECT
CONTEXT: query: update test
set j = j+1
where i = 1
returning j
PL/pgSQL function f_test() line 3 at RETURN QUERY
LOCATION: exec_stmt_return_query, pl_exec.c:3571
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-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, jorge@jrg.com.br
Subject: Re: BUG #17259: RETURN QUERY no longer accepts an UPDATE RETURNING
In-Reply-To: <17259-fc4d4f2e6924cc42@postgresql.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