Re: Data visibility

Поиск
Список
Период
Сортировка
От Rafal Pietrak
Тема Re: Data visibility
Дата
Msg-id 1160979218.26728.107.camel@zorro.isa-geek.com
обсуждение исходный текст
Ответ на Re: Data visibility  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Sun, 2006-10-15 at 18:16 -0400, Tom Lane wrote:
> Rafal Pietrak <rafal@zorro.isa-geek.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

В списке pgsql-general по дате отправления:

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: BEGIN WORK READ ONLY;
Следующее
От: "Magnus Hagander"
Дата:
Сообщение: Re: techdocs.2 how long has this be around?