From: Marko Tiikkaja <marko@joh.to>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8870: PL/PgSQL, SELECT .. INTO and the number of result columns
Date: Wed, 22 Jan 2014 10:56:38 +0100
Message-ID: <52DF95D6.50105@joh.to> (raw)
In-Reply-To: <25096.1390358888@sss.pgh.pa.us>
References: <20140118232509.26700.59523@wrigleys.postgresql.org>
<25794.1390089578@sss.pgh.pa.us>
<52DB2139.20604@joh.to>
<52DF1CA6.8020800@joh.to>
<25096.1390358888@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 1/22/14, 3:48 AM, Tom Lane wrote:
> Marko Tiikkaja <marko@joh.to> writes:
>> SELECT * INTO f1, f2 FROM lotsofcolumns;
>
>> I can't say I think this is a good idea, but not sure breaking this case
>> is worth it either.
>
> Um, I thought the whole point was to complain about that. If this isn't a
> mistake, how can you consistently maintain the other one is?
I'm sure you can see a difference between explicitly listing the wrong
number of columns and using * to ignore trailing columns. That said,
this *should* be an error according to the documentation, so it's
probably not the end of the world if we break it.
>> In bug #8893 there was some discussion which I interpreted to mean that
>> we could improve this a bit by checking the number of returned columns
>> during compile time if there's no * in the target list. Attached is a
>> crude patch attempting to do that, which appears to be working. Any
>> thoughts?
>
> Ick. I thought you wanted to do this at first execution, anyway, not in
> pl_gram.y.
Catching these errors at compile time would be ideal. If we also want
to catch the * cases we could also check the result structure before the
first execution.
Regards,
Marko Tiikkaja
--
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: marko@joh.to, tgl@sss.pgh.pa.us
Subject: Re: BUG #8870: PL/PgSQL, SELECT .. INTO and the number of result columns
In-Reply-To: <52DF95D6.50105@joh.to>
References: <20140118232509.26700.59523@wrigleys.postgresql.org> <25794.1390089578@sss.pgh.pa.us> <52DB2139.20604@joh.to> <52DF1CA6.8020800@joh.to> <25096.1390358888@sss.pgh.pa.us> <52DF95D6.50105@joh.to>
* 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