Received: from frithjof.reiner (a37.dialin.tuwien.ac.at [192.35.240.47]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f11Kr3q88181 for ; Thu, 1 Feb 2001 15:53:03 -0500 (EST) (envelope-from areiner@tph.tuwien.ac.at) Received: (qmail 1700 invoked by uid 500); 31 Jan 2001 21:39:06 -0000 From: "Albert REINER" Date: Wed, 31 Jan 2001 22:39:06 +0100 To: PostgreSQL-SQL Subject: PL/pgSQL: possible parsing or documentation bug? Message-ID: <20010131223906.A1337@frithjof> Mail-Followup-To: PostgreSQL-SQL Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-Archive-Number: 200102/3 X-Sequence-Number: 1171 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 Deutsch * English * Esperanto * Latine --------------------------------------------------------------------------