BUG #18195: PL/pgSQL: invalid syntax allowed in SELECT INTO statement - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18195: PL/pgSQL: invalid syntax allowed in SELECT INTO statement
Date
Msg-id 18195-95ee8b48a9d7cd93@postgresql.org
Whole thread Raw
Responses Re: BUG #18195: PL/pgSQL: invalid syntax allowed in SELECT INTO statement  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18195
Logged by:          Pavel Kulakov
Email address:      paul.kulakov@systematica.ru
PostgreSQL version: 15.5
Operating system:   Debian GNU/Linux 11
Description:

1. The following code is successfully executed although it has incorrect
syntax: there must be comma (,) between _n and _s in 'into' section.
The output is "_n = 1, _s = <NULL>"

2. Documentation
(https://www.postgresql.org/docs/current/plpgsql-statements.html) in 43.5.3.
says "the command's result columns must exactly match the structure of the
target as to number and data types, or else a run-time error occurs". But we
see that number of columns can differ from number of variables. 
I think either the documentation or the source code should be fixed.

do $sql$
declare _n int; _s text;
begin
   select 1, 'string1', 'string2'
   into _n _s;
   
   raise notice '_n = %, _s = %', _n, _s;
end;
$sql$;


pgsql-bugs by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: BUG #18179: Cluster History Error
Next
From: John Pace
Date:
Subject: Re: BUG #18194: Missing install instructions