pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Reinoud van Leeuwen <reinoud@xs4all.nl>
To: pgsql-hackers@postgresql.org
Subject: plpgsql strangeness with select into <variable>
Date: Fri, 18 Jul 2003 17:24:52 +0200
Message-ID: <20030718172452.L54220@spoetnik.xs4all.nl> (raw)

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_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: <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 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.

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



view thread (5+ messages)  latest in thread

Message-ID: <20030718172452.L54220@spoetnik.xs4all.nl>
Permalink:  ../20030718172452.L54220@spoetnik.xs4all.nl/
Also on:    postgresql.org/message-id/20030718172452.L54220@spoetnik.xs4all.nl

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: reinoud@xs4all.nl, pgsql-hackers@postgresql.org
  Subject: Re: plpgsql strangeness with select into <variable>
  In-Reply-To: <20030718172452.L54220@spoetnik.xs4all.nl>

* 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