From: | Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> |
---|---|
To: | Reinoud van Leeuwen <reinoud(at)xs4all(dot)nl> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: plpgsql strangeness with select into <variable> |
Date: | 2003-07-18 17:55:00 |
Message-ID: | 1058550900.24202.2833.camel@camel |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-sql |
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 <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.
>
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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2003-07-18 18:02:52 | Re: [pgsql-advocacy] [GENERAL] Postgresql & AMD x86-64 |
Previous Message | mallah | 2003-07-18 17:53:21 | Re: CREATE TYPE |
From | Date | Subject | |
---|---|---|---|
Next Message | Yudie | 2003-07-18 20:47:13 | how to copy table to another database? |
Previous Message | Dmitry Tkach | 2003-07-18 16:49:18 | Re: (trigger function) -> ERROR: NEW used in non-rule query |