Re: ROLLBACK triggers?

From: "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>
To: Stef T <stef(at)ummon(dot)com>
Cc: Daisuke Maki <daisuke(at)wafu(dot)ne(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ROLLBACK triggers?
Date: 2006-01-23 18:36:22
Message-ID: 36e682920601231036l3c1a76d4raf2dd92d9ff38a88@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hey Stef,

It's not my patch, it's Alfrânio Correia Júnior's. I don't think it would
be too difficult to add a hook for authentication, but that is off-topic.
If you would like to discuss it further, please create a new topic for it.

As for a rollback trigger, I don't really see too much of a use for it aside
from when you would need to notify an external application/database server
of commit/rollback such as what Daisuke would use it for or something which
could be extended by contrib modules (such as dblink, dblink_tds, ...). Of
course, people could always write bad transactional application code that
relies on this commit/rollback trigger, but that isn't the use case.

-Jonah

On 1/23/06, Stef T <stef(at)ummon(dot)com> wrote:
>
>
> Hello Jonah,
> Sorry for hi-jacking the thread (not my intent, I assure you) however,
> is there any chance Jonah of expanding your work to include 'on user
> login/logout' ?
>
> As an aside, a trigger on rollback seems... unlikely (at least to my
> mind). What is the functionality if your rollback trigger fails ? Ugh. Down
> that road I can see madness looming, however, this -is- monday so ... :)
>
> Regards
> Stef
>
> Jonah H. Harris wrote:
>
> Daisuke,
>
> A patch was done for replication hooks which implements global
> database-level triggers for connection startup and shutdown, and transaction
> begin, commit, and rollback; they may help you out in this situation.
>
> http://gorda.di.uminho.pt/community/pgsqlhooks/
>
> -Jonah
>
> On 1/23/06, Daisuke Maki <daisuke(at)wafu(dot)ne(dot)jp> wrote:
>
> > Hi,
> >
> > First, apologies if my question is a bit off-course. Please feel free to
> > direct me to a different mailing list if not appropriate.
> >
> > I'm currently trying to embed Senna full text search engine
> > ( http://qwik.jp/senna/) into postgres. I'm trying to achieve this by
> > using triggers (implemented in C) to cause an update to senna's index at
> > various points.
> >
> > This seemed to work fine until I realized that while postgres' SQL
> > commands could be rolled back, Senna's index remained already-changed.
> > There are other potential issues with regards to transaction safety, but
> > currently this seems to be a problem that I cannot fix by simply
> > patching Senna. So I thought that if there was a rollback trigger, I
> > could call whatever necessary to undo the changes that were made to the
> > index.
> >
> > A quick scan of the docs and the source code tree seems to indicate that
> >
> > there is no such thing as a rollback trigger, short of hacking it.
> >
> > Now, I'm wondering:
> > 1. Is there a rollback/commit trigger? If not, is it planned to be
> > implemented at all?
> > 2. Is there a way to undo changes to data external to postgres
> > when a rollback occurs, OR, only update that external data
> > when a commit occurs?
> >
> > Thanks in advance,
> > --d
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: Have you checked our extensive FAQ?
> >
> > http://wwwpostgresql.org/docs/faq<http://www.postgresql.org/docs/faq>
> >
>
> .
>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2006-01-23 20:19:19 Re: ROLLBACK triggers?
Previous Message Stef T 2006-01-23 17:30:59 Re: ROLLBACK triggers?