From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | Sam Mason <sam(at)samason(dot)me(dot)uk> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: deleting function |
Date: | 2009-04-25 14:45:16 |
Message-ID: | b42b73150904250745y6b18b23ev2347d43d246b63db@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Apr 24, 2009 at 12:15 PM, Sam Mason <sam(at)samason(dot)me(dot)uk> wrote:
> On Fri, Apr 24, 2009 at 11:55:48AM -0400, Tom Lane wrote:
>> pavunkumar <pavun(dot)bks(at)gmail(dot)com> writes:
>> > create or replace function newd(id integer ) returns void as $$
>> > delete from testing where id=$1;
>>
>> Don't use the same name for a parameter as you use for a table column
>> referenced in the function.
>
> I've found it helps to have a standard naming convention here; I only
> use identifiers starting with an underscore (i.e. "_") for function
> parameters and local variables. Column names always start with a lower
> case alphabetic letter. Other people will obviously have different ways
> of dealing with the ambiguity, but this has worked well for me so far.
I absolutely think this ('_' prefix) is the way to go. I make some
exceptions for locals, like n for number, etc. Some people argue for
using in_variable notation, but why use three characters when one is
good enough?
OTOH, I don't camel case columns. Can't please everyone... :-) Also,
to the OP, I'd really advise against naming columns 'id'...it creates
a mess. If you have a table foo, name column 'foo_id'. Less name
conflicts, cleaner queries.
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-04-25 15:28:15 | Re: Selling an 8.1 to 8.3 upgrade |
Previous Message | Merlin Moncure | 2009-04-25 14:38:22 | Re: Selling an 8.1 to 8.3 upgrade |