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$;