Re: [HACKERS] [PATCH] A hook for session start

2017-11-11 Thread Fabrízio de Royes Mello
On Sat, Nov 11, 2017 at 6:48 AM, Michael Paquier wrote: > > On Sat, Nov 11, 2017 at 12:49 AM, Fabrízio de Royes Mello > wrote: > > New version attached. > > Thanks. > > +++ b/src/test/modules/Makefile > test_extensions \ > +

Re: [HACKERS] [PATCH] A hook for session start

2017-11-11 Thread Michael Paquier
On Sat, Nov 11, 2017 at 12:49 AM, Fabrízio de Royes Mello wrote: > New version attached. Thanks. +++ b/src/test/modules/Makefile test_extensions \ + test_session_hooks \ test_parser Better if that's in alphabetical order. That's a nit

Re: [HACKERS] [PATCH] A hook for session start

2017-11-10 Thread Fabrízio de Royes Mello
On Thu, Nov 9, 2017 at 9:08 PM, Michael Paquier wrote: > > On Fri, Nov 10, 2017 at 2:32 AM, Fabrízio de Royes Mello > wrote: > > On Thu, Nov 9, 2017 at 12:09 AM, Michael Paquier < michael.paqu...@gmail.com> > > wrote: > >> +++

Re: [HACKERS] [PATCH] A hook for session start

2017-11-09 Thread Michael Paquier
On Fri, Nov 10, 2017 at 2:32 AM, Fabrízio de Royes Mello wrote: > On Thu, Nov 9, 2017 at 12:09 AM, Michael Paquier > wrote: >> +++ b/src/test/modules/test_session_hooks/session_hooks.conf >> @@ -0,0 +1 @@ >> +shared_preload_libraries =

Re: [HACKERS] [PATCH] A hook for session start

2017-11-09 Thread Fabrízio de Royes Mello
On Thu, Nov 9, 2017 at 12:09 AM, Michael Paquier wrote: > > On Thu, Nov 9, 2017 at 2:42 AM, Fabrízio de Royes Mello > wrote: > > On Wed, Nov 8, 2017 at 12:47 AM, Michael Paquier < michael.paqu...@gmail.com> > > wrote: > >> - Let's restrict the

Re: [HACKERS] [PATCH] A hook for session start

2017-11-08 Thread Michael Paquier
On Thu, Nov 9, 2017 at 2:42 AM, Fabrízio de Royes Mello wrote: > On Wed, Nov 8, 2017 at 12:47 AM, Michael Paquier > wrote: >> - Let's restrict the logging to a role name instead of a database >> name, and let's parametrize it with a setting in

Re: [HACKERS] [PATCH] A hook for session start

2017-11-08 Thread Fabrízio de Royes Mello
On Wed, Nov 8, 2017 at 12:47 AM, Michael Paquier wrote: > > + /* Hook just normal backends */ > + if (session_end_hook && MyBackendId != InvalidBackendId) > + (*session_end_hook) (); > I have been wondering about the necessity of this restriction. > Couldn't

Re: [HACKERS] [PATCH] A hook for session start

2017-11-07 Thread Michael Paquier
On Tue, Nov 7, 2017 at 9:58 PM, Fabrízio de Royes Mello wrote: > On Tue, Nov 7, 2017 at 1:15 AM, Michael Paquier > wrote: >> On Sun, Nov 5, 2017 at 3:14 AM, Fabrízio de Royes Mello >> wrote: >> I was going to to hack

Re: [HACKERS] [PATCH] A hook for session start

2017-11-07 Thread Fabrízio de Royes Mello
On Tue, Nov 7, 2017 at 1:15 AM, Michael Paquier wrote: > > On Sun, Nov 5, 2017 at 3:14 AM, Fabrízio de Royes Mello > wrote: > > On Sat, Nov 4, 2017 at 1:23 AM, Michael Paquier < michael.paqu...@gmail.com> > > wrote: > >> On Fri, Nov 3, 2017 at

Re: [HACKERS] [PATCH] A hook for session start

2017-11-06 Thread Michael Paquier
On Sun, Nov 5, 2017 at 3:14 AM, Fabrízio de Royes Mello wrote: > On Sat, Nov 4, 2017 at 1:23 AM, Michael Paquier > wrote: >> On Fri, Nov 3, 2017 at 1:55 PM, Fabrízio de Royes Mello >> wrote: >> >> Passing the database

Re: [HACKERS] [PATCH] A hook for session start

2017-11-04 Thread Fabrízio de Royes Mello
On Sat, Nov 4, 2017 at 1:23 AM, Michael Paquier wrote: > > On Fri, Nov 3, 2017 at 1:55 PM, Fabrízio de Royes Mello > wrote: > >> Passing the database name and user name does not look much useful to > >> me. You can have access to this data

Re: [HACKERS] [PATCH] A hook for session start

2017-11-03 Thread Michael Paquier
On Fri, Nov 3, 2017 at 1:55 PM, Fabrízio de Royes Mello wrote: >> Passing the database name and user name does not look much useful to >> me. You can have access to this data already with CurrentUserId and >> MyDatabaseId. > > This way we don't need to convert oid to

Re: [HACKERS] [PATCH] A hook for session start

2017-11-03 Thread Fabrízio de Royes Mello
On Fri, Nov 3, 2017 at 11:43 AM, Aleksandr Parfenov < a.parfe...@postgrespro.ru> wrote: > > README file in patch 0003 is a copy of README from test_pg_dump module > without any changes. > Thanks, I'll fix it. Regards, -- Fabrízio de Royes Mello Consultoria/Coaching PostgreSQL >> Timbira:

Re: [HACKERS] [PATCH] A hook for session start

2017-11-03 Thread Fabrízio de Royes Mello
On Fri, Nov 3, 2017 at 11:19 AM, Michael Paquier wrote: > > /* > + * Setup handler to session end hook > + */ > +if (IsUnderPostmaster) > +on_proc_exit(do_session_end_hook, 0); > I think that it would be better to place that in ShutdownPostgres.

Re: [HACKERS] [PATCH] A hook for session start

2017-11-03 Thread Aleksandr Parfenov
README file in patch 0003 is a copy of README from test_pg_dump module without any changes. -- Aleksandr Parfenov Postgres Professional: http://www.postgrespro.com Russian Postgres Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: [HACKERS] [PATCH] A hook for session start

2017-11-03 Thread Michael Paquier
On Thu, Nov 2, 2017 at 11:36 PM, Fabrízio de Royes Mello wrote: > On Thu, Nov 2, 2017 at 5:42 AM, Aleksandr Parfenov > wrote: >> Unfortunately, patches 0001 and 0002 don't apply to current master. >> >> The new status of this patch is: Waiting

Re: [HACKERS] [PATCH] A hook for session start

2017-11-02 Thread Fabrízio de Royes Mello
On Thu, Nov 2, 2017 at 5:42 AM, Aleksandr Parfenov < a.parfe...@postgrespro.ru> wrote: > > The following review has been posted through the commitfest application: > make installcheck-world: not tested > Implements feature: not tested > Spec compliant: not tested > Documentation:

Re: [HACKERS] [PATCH] A hook for session start

2017-11-02 Thread Aleksandr Parfenov
The following review has been posted through the commitfest application: make installcheck-world: not tested Implements feature: not tested Spec compliant: not tested Documentation:not tested Hi, Unfortunately, patches 0001 and 0002 don't apply to current master.

Re: [HACKERS] [PATCH] A hook for session start

2017-10-11 Thread Robert Haas
On Fri, Oct 6, 2017 at 3:36 PM, Nico Williams wrote: >> If global temporary tables should be effective, then you have not have >> modify system catalogue after creating. But lot of processes requires it - >> ANALYZE, query planning. > > But the nice thing about them is that

Re: [HACKERS] [PATCH] A hook for session start

2017-10-06 Thread Pavel Stehule
2017-10-07 6:49 GMT+02:00 Nico Williams : > On Sat, Oct 07, 2017 at 05:44:00AM +0200, Pavel Stehule wrote: > > 2017-10-06 21:36 GMT+02:00 Nico Williams : > > > But the nice thing about them is that you need only create them once, > so > > > leave them

Re: [HACKERS] [PATCH] A hook for session start

2017-10-06 Thread Nico Williams
On Sat, Oct 07, 2017 at 05:44:00AM +0200, Pavel Stehule wrote: > 2017-10-06 21:36 GMT+02:00 Nico Williams : > > But the nice thing about them is that you need only create them once, so > > leave them in the catalog. Stats about them should not be gathered nor > > stored,

Re: [HACKERS] [PATCH] A hook for session start

2017-10-06 Thread Pavel Stehule
2017-10-06 21:36 GMT+02:00 Nico Williams : > On Fri, Oct 06, 2017 at 08:51:53PM +0200, Pavel Stehule wrote: > > 2017-10-06 20:39 GMT+02:00 Nico Williams : > > > On Fri, Oct 06, 2017 at 06:37:57PM +0200, Pavel Stehule wrote: > > > > When we talked

Re: [HACKERS] [PATCH] A hook for session start

2017-10-06 Thread Nico Williams
On Fri, Oct 06, 2017 at 08:51:53PM +0200, Pavel Stehule wrote: > 2017-10-06 20:39 GMT+02:00 Nico Williams : > > On Fri, Oct 06, 2017 at 06:37:57PM +0200, Pavel Stehule wrote: > > > When we talked about this topic, there are two issues: > > > > > > a) probably not too hard

Re: [HACKERS] [PATCH] A hook for session start

2017-10-06 Thread Pavel Stehule
2017-10-06 20:39 GMT+02:00 Nico Williams : > On Fri, Oct 06, 2017 at 06:37:57PM +0200, Pavel Stehule wrote: > > 2017-10-06 6:48 GMT+02:00 Nico Williams : > > > On Fri, Oct 06, 2017 at 04:52:09AM +0200, Pavel Stehule wrote: > > > > Current TEMP tables,

Re: [HACKERS] [PATCH] A hook for session start

2017-10-06 Thread Nico Williams
On Fri, Oct 06, 2017 at 06:37:57PM +0200, Pavel Stehule wrote: > 2017-10-06 6:48 GMT+02:00 Nico Williams : > > On Fri, Oct 06, 2017 at 04:52:09AM +0200, Pavel Stehule wrote: > > > Current TEMP tables, if you do it for any session has pretty significant > > > overhead - with

Re: [HACKERS] [PATCH] A hook for session start

2017-10-06 Thread Pavel Stehule
2017-10-06 6:48 GMT+02:00 Nico Williams : > On Fri, Oct 06, 2017 at 04:52:09AM +0200, Pavel Stehule wrote: > > 2017-10-05 22:31 GMT+02:00 Nico Williams : > > > On Tue, Aug 01, 2017 at 03:36:23PM -0400, Peter Eisentraut wrote: > > > > On 7/21/17 13:14,

Re: [HACKERS] [PATCH] A hook for session start

2017-10-05 Thread Nico Williams
On Fri, Oct 06, 2017 at 11:04:38AM +0800, Craig Ringer wrote: > On 6 October 2017 at 10:52, Pavel Stehule wrote: > > > It is better to work on GLOBAL TEMP tables. > > > > Current TEMP tables, if you do it for any session has pretty significant > > overhead - with

Re: [HACKERS] [PATCH] A hook for session start

2017-10-05 Thread Nico Williams
On Fri, Oct 06, 2017 at 04:52:09AM +0200, Pavel Stehule wrote: > 2017-10-05 22:31 GMT+02:00 Nico Williams : > > On Tue, Aug 01, 2017 at 03:36:23PM -0400, Peter Eisentraut wrote: > > > On 7/21/17 13:14, Jim Mlodgenski wrote: > > > > When I first saw this thread, my initial

Re: [HACKERS] [PATCH] A hook for session start

2017-10-05 Thread Craig Ringer
On 6 October 2017 at 10:52, Pavel Stehule wrote: > It is better to work on GLOBAL TEMP tables. > > Current TEMP tables, if you do it for any session has pretty significant > overhead - with possible risk of performance lost (system catalog bloat). > > pretty significant

Re: [HACKERS] [PATCH] A hook for session start

2017-10-05 Thread Pavel Stehule
2017-10-05 22:31 GMT+02:00 Nico Williams : > On Tue, Aug 01, 2017 at 03:36:23PM -0400, Peter Eisentraut wrote: > > On 7/21/17 13:14, Jim Mlodgenski wrote: > > > When I first saw this thread, my initial thought of a use case is to > > > prepare some key application queries

Re: [HACKERS] [PATCH] A hook for session start

2017-10-05 Thread Nico Williams
On Tue, Aug 01, 2017 at 03:36:23PM -0400, Peter Eisentraut wrote: > On 7/21/17 13:14, Jim Mlodgenski wrote: > > When I first saw this thread, my initial thought of a use case is to > > prepare some key application queries so they are there and ready to go. > > That would need to be before the

Re: [HACKERS] [PATCH] A hook for session start

2017-10-05 Thread Nico Williams
On Fri, Jul 21, 2017 at 11:10:52PM +0800, Craig Ringer wrote: > What practical use cases are there for acting post-auth but that can't wait > until the user tries to do something? Creating TEMP schema that triggers and functions might need. Doing CREATE TEMP TABLE IF NOT EXISTS in triggers slows

Re: [HACKERS] [PATCH] A hook for session start

2017-10-05 Thread Fabrízio de Royes Mello
On Thu, Oct 5, 2017 at 4:14 PM, Fabrízio de Royes Mello < fabriziome...@gmail.com> wrote: > > > > On Tue, Aug 1, 2017 at 4:55 PM, Robert Haas wrote: > > > > On Tue, Aug 1, 2017 at 3:37 PM, Peter Eisentraut > > wrote: > > > On 7/21/17

Re: [HACKERS] [PATCH] A hook for session start

2017-10-05 Thread Fabrízio de Royes Mello
On Tue, Aug 1, 2017 at 4:55 PM, Robert Haas wrote: > > On Tue, Aug 1, 2017 at 3:37 PM, Peter Eisentraut > wrote: > > On 7/21/17 12:59, Robert Haas wrote: > >> That's an exceedingly-weak argument for rejecting this patch. The > >> fact

Re: [HACKERS] [PATCH] A hook for session start

2017-08-01 Thread Robert Haas
On Tue, Aug 1, 2017 at 3:37 PM, Peter Eisentraut wrote: > On 7/21/17 12:59, Robert Haas wrote: >> That's an exceedingly-weak argument for rejecting this patch. The >> fact that you can probably hack around the lack of a hook for most >> reasonable use cases is

Re: [HACKERS] [PATCH] A hook for session start

2017-08-01 Thread Andres Freund
On 2017-08-01 15:37:40 -0400, Peter Eisentraut wrote: > On 7/21/17 12:59, Robert Haas wrote: > > That's an exceedingly-weak argument for rejecting this patch. The > > fact that you can probably hack around the lack of a hook for most > > reasonable use cases is not an argument for having a hook

Re: [HACKERS] [PATCH] A hook for session start

2017-08-01 Thread Peter Eisentraut
On 7/21/17 12:59, Robert Haas wrote: > That's an exceedingly-weak argument for rejecting this patch. The > fact that you can probably hack around the lack of a hook for most > reasonable use cases is not an argument for having a hook that does > what people actually want to do. Still nobody has

Re: [HACKERS] [PATCH] A hook for session start

2017-08-01 Thread Peter Eisentraut
On 7/20/17 07:47, Yugo Nagata wrote: > Another patch, session_start_sample.patch, is a very simple > example of this hook that changes work_mem values for sessions > of a specific database. I think test modules should go into src/test/modules/ instead of contrib. -- Peter Eisentraut

Re: [HACKERS] [PATCH] A hook for session start

2017-08-01 Thread Peter Eisentraut
On 7/21/17 13:14, Jim Mlodgenski wrote: > When I first saw this thread, my initial thought of a use case is to > prepare some key application queries so they are there and ready to go. > That would need to be before the ExecutorStart_hook or > ProcessUtility_hook if an app would just want to

Re: [HACKERS] [PATCH] A hook for session start

2017-07-21 Thread Fabrízio de Royes Mello
On Fri, Jul 21, 2017 at 12:19 PM, Fabrízio de Royes Mello < fabriziome...@gmail.com> wrote: > > > On Fri, Jul 21, 2017 at 10:58 AM, Yugo Nagata wrote: > > > > On Fri, 21 Jul 2017 10:31:57 -0300 > > Fabrízio de Royes Mello wrote: > > > > > On Fri, Jul

Re: [HACKERS] [PATCH] A hook for session start

2017-07-21 Thread Jim Mlodgenski
> > > Can a user do anything remotely interesting or useful without hitting > either > > ExecutorStart_hook or ProcessUtility_hook? They can parse queries I guess > > but you could just set your hook up in the parser instead. If you hook > the > > parser all they can do is open an idle session and

Re: [HACKERS] [PATCH] A hook for session start

2017-07-21 Thread Robert Haas
On Fri, Jul 21, 2017 at 11:10 AM, Craig Ringer wrote: > Don't we have that timestamp already? > > What practical use cases are there for acting post-auth but that can't wait > until the user tries to do something? Have, yes; record, no. > Can a user do anything remotely

Re: [HACKERS] [PATCH] A hook for session start

2017-07-21 Thread Fabrízio de Royes Mello
On Fri, Jul 21, 2017 at 10:58 AM, Yugo Nagata wrote: > > On Fri, 21 Jul 2017 10:31:57 -0300 > Fabrízio de Royes Mello wrote: > > > On Fri, Jul 21, 2017 at 9:35 AM, Yugo Nagata wrote: > > > > > > On Fri, 21 Jul 2017 09:53:19

Re: [HACKERS] [PATCH] A hook for session start

2017-07-21 Thread Craig Ringer
On 21 Jul. 2017 21:58, "Yugo Nagata" wrote: On Fri, 21 Jul 2017 10:31:57 -0300 Fabrízio de Royes Mello wrote: > On Fri, Jul 21, 2017 at 9:35 AM, Yugo Nagata wrote: > > > > On Fri, 21 Jul 2017 09:53:19 +0800 > > Craig Ringer

Re: [HACKERS] [PATCH] A hook for session start

2017-07-21 Thread Yugo Nagata
On Fri, 21 Jul 2017 10:31:57 -0300 Fabrízio de Royes Mello wrote: > On Fri, Jul 21, 2017 at 9:35 AM, Yugo Nagata wrote: > > > > On Fri, 21 Jul 2017 09:53:19 +0800 > > Craig Ringer wrote: > > > > > On 21 July 2017 at 08:42,

Re: [HACKERS] [PATCH] A hook for session start

2017-07-21 Thread Fabrízio de Royes Mello
On Fri, Jul 21, 2017 at 9:35 AM, Yugo Nagata wrote: > > On Fri, 21 Jul 2017 09:53:19 +0800 > Craig Ringer wrote: > > > On 21 July 2017 at 08:42, Robert Haas wrote: > > > > > On Thu, Jul 20, 2017 at 8:27 AM, Fabrízio de Royes

Re: [HACKERS] [PATCH] A hook for session start

2017-07-21 Thread Yugo Nagata
On Fri, 21 Jul 2017 09:53:19 +0800 Craig Ringer wrote: > On 21 July 2017 at 08:42, Robert Haas wrote: > > > On Thu, Jul 20, 2017 at 8:27 AM, Fabrízio de Royes Mello > > wrote: > > > I'm not sure your real needs but doesn't

Re: [HACKERS] [PATCH] A hook for session start

2017-07-20 Thread Craig Ringer
On 21 July 2017 at 08:42, Robert Haas wrote: > On Thu, Jul 20, 2017 at 8:27 AM, Fabrízio de Royes Mello > wrote: > > I'm not sure your real needs but doesn't it material for improve Event > > Triggers??? > > I've thought about that, too. One

Re: [HACKERS] [PATCH] A hook for session start

2017-07-20 Thread Robert Haas
On Thu, Jul 20, 2017 at 8:27 AM, Fabrízio de Royes Mello wrote: > I'm not sure your real needs but doesn't it material for improve Event > Triggers??? I've thought about that, too. One problem is what to do if the user hits ^C while the event trigger procedure is

Re: [HACKERS] [PATCH] A hook for session start

2017-07-20 Thread Fabrízio de Royes Mello
On Thu, Jul 20, 2017 at 8:47 AM, Yugo Nagata wrote: > > Hi, > > Currently, PostgreSQL doen't have a hook triggered at session > start. Although we already have ClientAuthentication_hook, > this is triggered during authentication, so we can not > access the database. > > If we

[HACKERS] [PATCH] A hook for session start

2017-07-20 Thread Yugo Nagata
Hi, Currently, PostgreSQL doen't have a hook triggered at session start. Although we already have ClientAuthentication_hook, this is triggered during authentication, so we can not access the database. If we have a hook triggerd only once at session start, we may do something useful on the