Re: Trigger to run @ connection time?

From: "Marko Kreen" <markokr(at)gmail(dot)com>
To: "Dawid Kuroczko" <qnex42(at)gmail(dot)com>
Cc: "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Trigger to run @ connection time?
Date: 2008-03-14 12:17:54
Message-ID: e51f66da0803140517p3505d543v594a4758fb1bbc44@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/14/08, Dawid Kuroczko <qnex42(at)gmail(dot)com> wrote:
> On Thu, Mar 13, 2008 at 2:18 PM, Marko Kreen <markokr(at)gmail(dot)com> wrote:
> > On 3/13/08, Dawid Kuroczko <qnex42(at)gmail(dot)com> wrote:
> > > An application which uses tsearch2 ('SELECT set_curdict() / set_curcfg()' being
> > > called upon session start). That is fine and that works.
> > >
> > > Now, using statement pooling solution like pgbouncer is great benefit for this
> > > specific application. There is one little problem however -- one can never be
> > > sure when session is started. As a countermeasure there is a need to call
> > > set_curdict() in every transaction (which is very fast), but one needs
> > > to remember
> > > to call that set_curdict() every time.
> > >
> > > ON CONNECT trigger would solve that neatly!
> >
> > Hm. It seems to make more sense to implement connect-time
> > hook directly in pgbouncer.
>
> Indeed that would solve the issue. But then again it could be argued that
> PL/pgSQL could be implemented outside the backend as well. ;-)

Well, as the transaction-pooling breaks application expectations
and makes impossible for them to do initial setup, the connect
hook could give a way to compensate for that.

> I see it as an addition which does have its applications.

To put it to core Postgres, it needs to be conceptually sane
first, without needing ugly workarounds to avoid it bringing
whole db down.

I can see ATM only few ways:

- Applies only to non-superusers.

- Error from CONNECT trigger does not affect superuser.

- Applies to database + role. Role could be also group of users.

So you always have way do fix things, without hexediting in data dir...

--
marko

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2008-03-14 12:20:41 Re: Blobs
Previous Message paul rivers 2008-03-14 11:35:16 Re: PG secure for financial applications ...