Re: pgpsql help

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Mike G(dot)" <mike(at)thegodshalls(dot)com>
Cc: LENGYEL Zoltan <warnew(at)warnew(dot)nomaam(dot)hu>, pgsql-general(at)postgresql(dot)org
Subject: Re: pgpsql help
Date: 2005-01-17 05:31:43
Message-ID: 23179.1105939903@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Mike G." <mike(at)thegodshalls(dot)com> writes:
> Maybe it is because 'name' is a sql 92/99 non-reserved / key word?

No, it's because of careless choice of plpgsql variable names.

>> declare
>> uri alias for $3;
>> ...
>> insert into uri (articleid,uri,uritype) values (article_id,uri,urit_id);
^^^ ^^^ ^^^

Not being exceedingly bright, plpgsql will attempt to substitute its
variable into all three matches in this command. Two of those are
of course wrong and lead to syntax errors.

First rule of plpgsql programming: do not use plpgsql variable names
that duplicate any of the SQL-level names (tables, columns, functions,
etc) you intend to use in the function.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message mstory 2005-01-17 05:56:04 deleting from arrays
Previous Message Mike G. 2005-01-17 05:08:16 Re: pgpsql help