From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | jorge(at)jrg(dot)com(dot)br |
Subject: | BUG #17259: RETURN QUERY no longer accepts an UPDATE RETURNING |
Date: | 2021-10-31 01:11:32 |
Message-ID: | 17259-fc4d4f2e6924cc42@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 17259
Logged by: Jorge Gualtieri
Email address: jorge(at)jrg(dot)com(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Sandeep Thakkar | 2021-10-31 07:31:00 | Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data |
Previous Message | Andres Freund | 2021-10-30 22:18:24 | Re: BUG #17245: Index corruption involving deduplicated entries |