pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #17259: RETURN QUERY no longer accepts an UPDATE RETURNING
2+ messages / 2 participants
[nested] [flat]

* BUG #17259: RETURN QUERY no longer accepts an UPDATE RETURNING
@ 2021-10-31 01:11 PG Bug reporting form <noreply@postgresql.org>
  2021-10-31 14:38 ` Re: BUG #17259: RETURN QUERY no longer accepts an UPDATE RETURNING Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2021-10-31 01:11 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: jorge@jrg.com.br

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #17259: RETURN QUERY no longer accepts an UPDATE RETURNING
  2021-10-31 01:11 BUG #17259: RETURN QUERY no longer accepts an UPDATE RETURNING PG Bug reporting form <noreply@postgresql.org>
@ 2021-10-31 14:38 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-10-31 14:38 UTC (permalink / raw)
  To: jorge@jrg.com.br; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> In version 14.0 RETURN QUERY with UPDATE RETURNING in a function is
> reporting an error and it works in version 13.4.

Thanks for the report!  This was already reported and repaired [1],
so it should be okay in 14.1.

			regards, tom lane

[1] https://www.postgresql.org/message-id/1F2F75F0-27DF-406F-848D-8B50C7EEF06A%40gmail.com





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-10-31 14:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-31 01:11 BUG #17259: RETURN QUERY no longer accepts an UPDATE RETURNING PG Bug reporting form <noreply@postgresql.org>
2021-10-31 14:38 ` Tom Lane <tgl@sss.pgh.pa.us>

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