Tom Lane wrote:
> 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?
At the protocol level, when the opening of a new session is requested,
how about a "skip connect-trigger" run-time parameter? This parameter
would be ignored (or an error being raised) if the connect isn't issued
by the owner of the database or a superuser.
Within client applications, the functionality could then be implemented
at the same level than the other connection parameters, I'm thinking of
a checkbox in a GUI or an additional parameter to the \connect psql
command.
By comparison, Oracle's solution to this is a grantable privilege that
causes their "logon triggers" to ignore any error.
--
Daniel
PostgreSQL-powered mail user agent and storage:
http://www.manitou-mail.org