BUG #18195: PL/pgSQL: invalid syntax allowed in SELECT INTO statement

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: paul(dot)kulakov(at)systematica(dot)ru
Subject: BUG #18195: PL/pgSQL: invalid syntax allowed in SELECT INTO statement
Date: 2023-11-14 13:00:00
Message-ID: 18195-95ee8b48a9d7cd93@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: 18195
Logged by: Pavel Kulakov
Email address: paul(dot)kulakov(at)systematica(dot)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$;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message John Pace 2023-11-14 15:06:00 Re: BUG #18194: Missing install instructions
Previous Message Aleksander Alekseev 2023-11-14 12:10:05 Re: BUG #18097: Immutable expression not allowed in generated at