X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 5FFB2CCDB3 for ; Fri, 18 Jul 2003 17:54:31 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 14464-02 for ; Fri, 18 Jul 2003 17:55:01 +0000 (GMT) Received: from localhost.localdomain (unknown [65.217.53.66]) by svr1.postgresql.org (Postfix) with ESMTP id 16936CCDAE for ; Fri, 18 Jul 2003 14:54:29 -0300 (ADT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h6IGVsqd016999; Fri, 18 Jul 2003 12:31:54 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h6IHt1Z00465; Fri, 18 Jul 2003 13:55:01 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 34ADLRY9; Fri, 18 Jul 2003 13:54:59 -0400 Subject: Re: plpgsql strangeness with select into From: Robert Treat To: Reinoud van Leeuwen Cc: pgsql-hackers@postgresql.org In-Reply-To: <20030718172452.L54220@spoetnik.xs4all.nl> References: <20030718172452.L54220@spoetnik.xs4all.nl> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 18 Jul 2003 13:55:00 -0400 Message-Id: <1058550900.24202.2833.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/428 X-Sequence-Number: 41033 On Fri, 2003-07-18 at 11:24, Reinoud van Leeuwen wrote: > I'm debugging a trigger in plpgsql and for some reason or the "select > into " does not seem to work. Here is an unaltered snippet of my > trigger code: > > raise notice ''this id : %'',NEW.id; > > select into i_hierarchy_id > hierarchy_id > from link_def LD, > link L, > object_link OL > where OL.id = NEW.id > and L.id = OL.link_id > and LD.id = L.link_def_id; > > raise notice ''i_hierarchy_id: %'',i_hierarchy_id; > > > in the log this results in: > > NOTICE: this id : 5265 > NOTICE: i_hierarchy_id: > > but when I perform the query on the command line I do get a result: > > select hierarchy_id > from link_def LD, > link L, > object_link OL > where OL.id = 5264 > and L.id = OL.link_id > and LD.id = L.link_def_id; > > hierarchy_id > -------------- > 1 > (1 row) > > i_hierarchy_id is declared as integer and is not used before this code nor > as a column name anywhere. > > Does anyone have a clue what is going wrong? I use Postgresql 7.3.3 on > FreeBSD 4.5. > try giving it a default of 0 in the declare statement, if that doesn't work, post the whole code for the function. Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL