From: Tom Lane <tgl@sss.pgh.pa.us>
To: marko@joh.to
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8870: PL/PgSQL, SELECT .. INTO and the number of result columns
Date: Sat, 18 Jan 2014 18:59:38 -0500
Message-ID: <25794.1390089578@sss.pgh.pa.us> (raw)
In-Reply-To: <20140118232509.26700.59523@wrigleys.postgresql.org>
References: <20140118232509.26700.59523@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
marko@joh.to writes:
> =# create function f() returns void as
> -# $$declare
> $# f1 int;
> $# begin
> $# select 1, 2 into f1;
> $# end
> $# $$ language plpgsql;
> CREATE FUNCTION
> =# select f();
> f
> ---
> (1 row)
> This seems to have been broken by commit
> 8bb3c8fe5413103c30ba8d1bcb3a1f8e46bddf3d.
Did you really test against a pre-2001 plpgsql?
The comments in that commit are correct as far as they go: we *must* be
willing to accept tuples with more or fewer attributes than the row has
fields, or unpleasant things will happen with code that is correct on
its face, if the table it's fetching from has inheritance children
and/or has been subject to ALTER TABLE.
ISTM what you're really asking for is a compile time (not run-time) check
that the number of INTO targets matches the nominal number of output
columns of the query. Not sure how difficult that is, but it'd be more
likely to be successful than messing with the run-time behavior in
exec_move_row.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, marko@joh.to
Subject: Re: BUG #8870: PL/PgSQL, SELECT .. INTO and the number of result columns
In-Reply-To: <25794.1390089578@sss.pgh.pa.us>
References: <20140118232509.26700.59523@wrigleys.postgresql.org> <25794.1390089578@sss.pgh.pa.us>
* 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