From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: paul.kulakov@systematica.ru
Subject: BUG #18195: PL/pgSQL: invalid syntax allowed in SELECT INTO statement
Date: Tue, 14 Nov 2023 13:00:00 +0000
Message-ID: <18195-95ee8b48a9d7cd93@postgresql.org> (raw)
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$;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, paul.kulakov@systematica.ru
Subject: Re: BUG #18195: PL/pgSQL: invalid syntax allowed in SELECT INTO statement
In-Reply-To: <18195-95ee8b48a9d7cd93@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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