From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: parameters in functions and overlap with names of columns |
Date: | 2009-08-04 15:03:57 |
Message-ID: | 162867790908040803h310bc319v8635a6e08dd5ee05@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2009/8/4 Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>:
> On Tue, 4 Aug 2009 16:01:58 +0200
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>
>> 2009/8/4 Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>:
>> > I've
>> >
>> > create or replace function(...
>> >
>> > declare
>> > col1 varchar(32);
>> > ...
>> >
>> > create table pippo(
>> > col1 varchar(32),
>> > ...
>> >
>> > Unfortunately I can't schema specify the column to avoid name
>> > overlap.
>> >
>> > Is there another way other than just simply rename the variable?
>>
>> yes - the most common is an using of prefix '_' for local plpgsql
>> variables. Other possibility is using qualified names.
>
> Just to be sure... by qualified names you mean schema qualified name
> or table qualified names in case of columns... right...
>
> For a second I had the hope there was another way other than having a
> col1, a _col1 and a __col1 too ;)
>
Maybe prefix _ isn't nice, but it is 100% safe. I use both - prefix
for variables and aliases for columns. The collision of column and
variable names is over lot of very strange bugs, and any way that can
protect us is perfect.
Pavel
> --
> Ivan Sergio Borgonovo
> http://www.webthatworks.it
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Paul Taylor | 2009-08-04 15:04:42 | Re: Does derby have an embedded Mode like Derby ? |
Previous Message | Magnus Hagander | 2009-08-04 15:02:32 | Re: InitDB 8.3.7 fails on Windows - Failed system call was MapViewOfFileEx |