Re: Trigger to run @ connection time?

From: "Marko Kreen" <markokr(at)gmail(dot)com>
To: "Dawid Kuroczko" <qnex42(at)gmail(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Kynn Jones" <kynnjo(at)gmail(dot)com>, "Alban Hertroys" <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>, "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Trigger to run @ connection time?
Date: 2008-03-13 13:18:19
Message-ID: e51f66da0803130618y7f5c6890ycc932988c53a4096@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/13/08, Dawid Kuroczko <qnex42(at)gmail(dot)com> wrote:
> On Tue, Mar 11, 2008 at 10:28 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > "Kynn Jones" <kynnjo(at)gmail(dot)com> writes:
> > > If one can set up this insert operation so that it happens automatically
> > > whenever a new connection is made, I'd like to learn how it's done.
> >
> > For manual psql sessions, you can put some setup commands in ~/.psqlrc.
> > In any other context I'm afraid you're stuck with modifying your client
> > application code.
> >
> > An ON CONNECT trigger enforced by the database seems a bit scary to me.
> > If it's broken, how you gonna get into the DB to fix it?
>
>
> Well, I would benefit from ON CONNECT trigger, I must admit.
>
> 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.

--
marko

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Roberts, Jon 2008-03-13 14:23:48 Re: pg_type.relacl
Previous Message Clodoaldo 2008-03-13 13:12:07 Reindex does not finish 8.2.6