Re: pgpsql help

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pgpsql help
Дата
Msg-id 23179.1105939903@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pgpsql help  ("Mike G." <mike@thegodshalls.com>)
Список pgsql-general
"Mike G." <mike@thegodshalls.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: pgpsql help
Следующее
От: mstory@uchicago.edu
Дата:
Сообщение: deleting from arrays