Re: Trigger to run @ connection time?

From: "Kynn Jones" <kynnjo(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Trigger to run @ connection time?
Date: 2008-03-12 11:52:29
Message-ID: c2350ba40803120452nc754ceeia29695b78c56ad1d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Mar 11, 2008 at 5: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?

I guess I don't know just *how broken* a trigger can be :-) ! I guess what
you're saying is that a trigger can be *so badly broken* that, even if
executed in response to a regular INSERT/UPDATE/DELETE event, it would
disable the database to the point that the only recourse would be to kill
the connection and open a new one. Such a trigger, if it were associated
with an CONNECT event, would render the database inaccessible. It follows
from Murphy's law that triggers that are this broken are certainly
possible...

Which is a long-winded way to say that I see your point!

Kynn

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2008-03-12 12:11:13 Re: Trouble with Savepoints in postgres
Previous Message Ivan Sergio Borgonovo 2008-03-12 11:48:22 Re: FROM + JOIN when more than one table in FROM