| From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
|---|---|
| To: | Brendan Jurd <direvus(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Clobbered parameter names via DECLARE in PL/PgSQL |
| Date: | 2012-04-15 09:26:01 |
| Message-ID: | CAFj8pRD=1P=Hwn5UT_K+TqcoXPCAH_Q+TtsUQnR8dark-m51ew@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
2012/4/15 Brendan Jurd <direvus(at)gmail(dot)com>:
> On 15 April 2012 18:54, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> 2012/4/15 Brendan Jurd <direvus(at)gmail(dot)com>:
>>> Perhaps it's a failure of imagination on my part, but I can't think of
>>> a legitimate reason for a programmer to deliberately use the same name
>>> to refer to a declared variable and a function parameter. What would
>>> be the benefit?
>>
>> it depends on level of nesting blocks. For simple functions there
>> parameter redeclaration is clean bug, but for more nested blocks and
>> complex procedures, there should be interesting using some local
>> variables with same identifier like some parameters and blocking
>> parameter's identifier can be same unfriendly feature like RO
>> parameters in previous pg versions.
>>
>> I understand your motivation well, but solution should be warning, not
>> blocking. I think.
>
> I can accept that ... but I wonder about the implementation of such a
> warning. Can we raise a WARNING message on CREATE [OR REPLACE]
> FUNCTION? If so, should there be a way to switch it off? If so,
> would this be implemented globally, or per-function? Would it be a
> postgres run-time setting, or an extension to CREATE FUNCTION syntax,
> or something within the PL/pgSQL code (like Perl's 'use strict')?
We can raise warning from CREATE OR REPLACE FUNCTION - but I would to
like have plpgsql_check_function inside core - and it is better place
for this and similar issues.
Now we talk about features in 9.3, and there check_function should be.
Regards
Pavel
>
> Cheers,
> BJ
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Simon Riggs | 2012-04-15 09:46:12 | Re: Last gasp |
| Previous Message | Pavel Stehule | 2012-04-15 09:20:42 | Re: BUG #6572: The example of SPI_execute is bogus |