From: Albert REINER <areiner@tph.tuwien.ac.at>
To: PostgreSQL-SQL <pgsql-sql@postgreSQL.org>
Subject: PL/pgSQL: possible parsing or documentation bug?
Date: Wed, 31 Jan 2001 22:39:06 +0100
Message-ID: <20010131223906.A1337@frithjof> (raw)
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 where name = $1;
raise notice ''ID found: %'', id;
if id is null then
insert into author (name) values ($1);
select currval(''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
--------------------------------------------------------------------------
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: areiner@tph.tuwien.ac.at
Subject: Re: PL/pgSQL: possible parsing or documentation bug?
In-Reply-To: <20010131223906.A1337@frithjof>
References: <20010131223906.A1337@frithjof>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox