Re: Trigger when user logs in - Mailing list pgsql-general

From Schneider, Jeremy
Subject Re: Trigger when user logs in
Date
Msg-id 46D55D2C-5496-4867-9B87-3D865D71BCD2@amazon.com
Whole thread Raw
In response to Re: Trigger when user logs in  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Trigger when user logs in  ("Schneider, Jeremy" <schnjere@amazon.com>)
Re: Trigger when user logs in  (Ron <ronljohnsonjr@gmail.com>)
List pgsql-general
> On Apr 11, 2019, at 19:52, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> Ron <ronljohnsonjr@gmail.com> writes:
>> I bet requests like this will start to make it onto the beaten path.
> 
> Meh.  I'm not that excited about inventing our own versions of wheels
> that already exist, especially when there's nothing very Postgres-specific
> about the requirements.  Notice that the example I pointed you at is for
> sshd not Postgres.  IMO the fact that you can use the same tool to solve
> both cases is a good thing.

This might work for sending an email, but not very useful if I want to do something in the database.

For example, one very common use of logon triggers in other databases is to look at various connection parameters (like
usernameor source IP) and enable sql logging or debugging for only certain cases (not always doing the same thing for a
particularuser). Another common use case is to do something like running plpgsql or manipulating data in db tables -
butagain looking at some combination of things at a database level to make a decision about what to do; for example the
applicationitself might enable or disable certain behaviors by setting values in a configuration table.
 

I’m still trying to work out the best approach for solving these sorts of use cases in current versions of
PostgreSQL...I’m curious how others are solving this?
 

-Jeremy

Sent from my TI-83

pgsql-general by date:

Previous
From: Paul van der Linden
Date:
Subject: Re: Safe to delete files?
Next
From: "Schneider, Jeremy"
Date:
Subject: Re: Trigger when user logs in