From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Marko Tiikkaja <marko(at)joh(dot)to> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #8870: PL/PgSQL, SELECT .. INTO and the number of result columns |
Date: | 2014-01-22 10:12:22 |
Message-ID: | CAFj8pRDcuvTDNi7PyFfi8MRN7ROwNYoDMKBv2tk6=ZwLe1HSNA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
2014/1/22 Marko Tiikkaja <marko(at)joh(dot)to>
> On 1/22/14, 3:48 AM, Tom Lane wrote:
>
> Marko Tiikkaja <marko(at)joh(dot)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.
>
It is exactly it what is done by plpgsql_check_function - without
introduction new dependencies and without possible performance impacts.
Regards
Pavel
>
>
> Regards,
> Marko Tiikkaja
>
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2014-01-22 14:57:07 | Re: Re: [BUGS] BUG #7873: pg_restore --clean tries to drop tables that don't exist |
Previous Message | Marko Tiikkaja | 2014-01-22 09:56:38 | Re: BUG #8870: PL/PgSQL, SELECT .. INTO and the number of result columns |