plpgsql strangeness with select into - Mailing list pgsql-hackers

From Reinoud van Leeuwen
Subject plpgsql strangeness with select into
Date
Msg-id 20030718172452.L54220@spoetnik.xs4all.nl
Whole thread Raw
Responses Re: plpgsql strangeness with select into  (Robert Treat <xzilla@users.sourceforge.net>)
Re: plpgsql strangeness with select into  (Philip Warner <pjw@rhyme.com.au>)
List pgsql-hackers
I'm debugging a trigger in plpgsql and for some reason or the "select 
into <var>" 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_linkOL       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: <NULL>

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 OLwhere 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.

-- 
__________________________________________________
"Nothing is as subjective as reality"
Reinoud van Leeuwen    reinoud.v@n.leeuwen.net
http://www.xs4all.nl/~reinoud
__________________________________________________


pgsql-hackers by date:

Previous
From: Rod Taylor
Date:
Subject: Re: pgsql-server/src/backend/commands comment.c
Next
From: Josh Berkus
Date:
Subject: Another TODO for PL/pgSQL -- Dynamic colums