Re: Data visibility

From: Rafal Pietrak <rafal(at)zorro(dot)isa-geek(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Data visibility
Date: 2006-10-16 06:13:38
Message-ID: 1160979218.26728.107.camel@zorro.isa-geek.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 2006-10-15 at 18:16 -0400, Tom Lane wrote:
> Rafal Pietrak <rafal(at)zorro(dot)isa-geek(dot)com> writes:
> > Hmm. I tried that, But I'm stuck with finding a way to propagate the
> > 'intermediate data' between BEFORE/AFTER triggers, *outside* of a TABLE
> > structure. That data is easily accesable inside the BEFORE TRIGGER as
> > simple variable.
>
> Um ... what data do you think is visible to the BEFORE trigger but not
> the AFTER trigger? They both see both states of the row, if that's what
> you're wondering.

No, no. I don't 'think' the data is lost between BEFORE and AFTER. I
*make* them disapear.... as I cannot find any place to pass them over.
The MASTSTER table does not contain columns for them ... and will not.
But in the BEFORE trigger function, I have them as local variables.

Are there ways to have my private 'virtual placeholder'? - like *NEW*
and *OLD* are? Placeholders which are outside of any table, and
available just inside the INSERT transaction, but throuout *all* it's
triggers.

Taking reference from other languages, I might think of some sort of
static variables:
CREATE FUNCTION piko() ....$$ DECLARE priv RECORD STATIC; BEGIN ....
END;
... or
CREATE FUNCTION piko(priv RECORD STATIC) ....

so that another function used for another trigger on that same table
will have access to the same record, which would retain data throught
the transactoin?

Just ideas. But may be there are currently tools to have such
functionality?

But if nothing like this is available, I think I'll need an additional
table, identical to AUX - sort of AUX shadow, but without foreign key
constraint to MASTER, so that I can put my data there in BEFORE, then
copy those into the AUX in AFTER, and purge the aux-shadow on exit from
AFTER.

In any case, discussion helps. Thenx.

--
-R

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2006-10-16 07:40:42 Re: techdocs.2 how long has this be around?
Previous Message David Fetter 2006-10-16 05:42:18 Re: BEGIN WORK READ ONLY;