What hook would you recommend for "one time, post authentication"?

From: Daniel Farina <daniel(at)heroku(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: What hook would you recommend for "one time, post authentication"?
Date: 2013-10-29 00:33:04
Message-ID: CAAZKuFacwieFFCUeyvFQeD21OZwsx+udWR+9WnM8QgVuGLvpSQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

What hook would you recommend that matches this criteria:

* Runs post-authentication

* ..Once

I was putting together a little extension module[0] intended to do
connection limits out-of-band with the catalog (so that hot standbys
and primaries can have different imposed connection limits), but am
stymied because I can't locate a hook matching this description.

My general approach has been to try to use
GetUserNameFromId(GetSessionUserId()), but this requires
InitializeSessionUserId be called first, and that has been causing me
some trouble.

ClientAuthentication_hook is too early (authentication has not yet
happened, InitializeSessionUserId has not been called). Many of the
other hooks are run per query (like the Executor hooks). And,
postinit.c is not giving me a lot of clues here and nothing with the
lexeme 'hook' is giving me a lot of confidence as seen in
typedefs.list/grep.

I appreciate any advice one can supply, thank you.

[0]: https://github.com/fdr/pg_connlimit

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Naoya Anzai 2013-10-29 00:53:41 Re: PostgreSQL Service on Windows does not start. ~ "is not a valid Win32 application"
Previous Message Peter Eisentraut 2013-10-28 21:15:12 Re: OSX doesn't accept identical source/target for strcpy() anymore