PL/pgSQL: possible parsing or documentation bug?

Поиск
Список
Период
Сортировка
От Albert REINER
Тема PL/pgSQL: possible parsing or documentation bug?
Дата
Msg-id 20010131223906.A1337@frithjof
обсуждение исходный текст
Ответы const cast ?  (<doj@wwws2.redaex.de>)
Re: PL/pgSQL: possible parsing or documentation bug?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
Saluton,

plpgsql seems to get confused when using variable names that coincide
with, e.g., column names:

create Function IdOfPossiblyNewAuthor(text) returns int4 as ' declare   id int4; begin   select id into id from author
wherename = $1;   raise notice ''ID found: %'', id;   if id is null then     insert into author (name) values ($1);
selectcurrval(''author_id_seq'') into id;     raise debug ''Author inserted. ID: %'', id;   end if;   return id; end;
 
' language 'plpgsql' with (IsCachable);

Logically it is clear which "id" should be parsed as the variable,
which as author.id, but I have to use a different name to make this
work. I do not see any mention on this restriction of variable names
(the full extent of which I do not know) in the documentation (7.0.2).

Albert.


-- 

--------------------------------------------------------------------------
Albert Reiner                                   <areiner@tph.tuwien.ac.at>
Deutsch       *       English       *       Esperanto       *       Latine
--------------------------------------------------------------------------


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

Предыдущее
От: Peter T Mount
Дата:
Сообщение: Re: Image insertion by using BLOB
Следующее
От: Ramiro Arenas Ramírez
Дата:
Сообщение: how to create this trigger?