pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
plpsql function problem
2+ messages / 2 participants
[nested] [flat]

* plpsql function problem
@ 2005-01-05 19:45 drdani@mazsola.iit.uni-miskolc.hu
  2005-01-05 20:53 ` Re: plpsql function problem Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: drdani@mazsola.iit.uni-miskolc.hu @ 2005-01-05 19:45 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I'm writing a plpgsql function. There is an insert in it (let's say to 
table1). This insert causes to call a trigger function which inserts 
some info to an other table (let's say table2):

function
   .
   insert into table1 ...  --> trigger function (runs after insert)
                                  .
                                  insert into table2 ...
   .
   select from table2 ... not found
   .

This info looks to be unavailable inside the function. Can it be made 
availabel or must this whole thing reorgenized?

Daniel



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: plpsql function problem
  2005-01-05 19:45 plpsql function problem drdani@mazsola.iit.uni-miskolc.hu
@ 2005-01-05 20:53 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2005-01-05 20:53 UTC (permalink / raw)
  To: drdani@mazsola.iit.uni-miskolc.hu; +Cc: pgsql-sql

drdani@mazsola.iit.uni-miskolc.hu writes:
> function
>    .
>    insert into table1 ...  --> trigger function (runs after insert)
>                                   .
>                                   insert into table2 ...
>    .
>    select from table2 ... not found
>    .

> This info looks to be unavailable inside the function. Can it be made 
> availabel or must this whole thing reorgenized?

If it's an AFTER trigger, the trigger is currently not fired until the
end of the entire command (ie, whatever interactive command called your
function).  So the SELECT isn't seeing the result because it hasn't
happened yet.

This will change in PG 8.0.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-01-05 20:53 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-01-05 19:45 plpsql function problem drdani@mazsola.iit.uni-miskolc.hu
2005-01-05 20:53 ` Tom Lane <tgl@sss.pgh.pa.us>

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