From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, "Yotsunaga, Naoki" <yotsunaga(dot)naoki(at)jp(dot)fujitsu(dot)com>, 'Postgres hackers' <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: automatic restore point |
Date: | 2018-10-01 22:06:32 |
Message-ID: | 20181001220632.7a4jnzph2cwntq6w@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2018-Oct-01, Peter Eisentraut wrote:
> The following appears to work:
>
> CREATE FUNCTION evt_automatic_restart_point() RETURNS event_trigger
> LANGUAGE plpgsql
> AS $$
> BEGIN
> PERFORM pg_create_restore_point(tg_tag);
> END
> $$;
>
> CREATE EVENT TRIGGER automatic_restart_point ON ddl_command_start
> EXECUTE PROCEDURE evt_automatic_restart_point();
>
> Are there any concerns about this?
Mumble.
Re-reading the implementation in standard_ProcessUtility, I wonder what
is PROCESS_UTILITY_QUERY_NONATOMIC -- there seems to be a maze through
SPI that determines whether this flag is set or not, which could affect
whether the event trigger is useful. Are utilities executed through a
procedure detected by event triggers? If so, then this mechanism seems
good enough to me. But if there's a way to sneak utility commands (DROP
TABLE) without the event trigger being invoked, then no (and in that
case maybe it's just a bug in procedures and we can still not include
this patch).
(Grepping for "atomic" is unsurprisingly unhelpful. I really wish we
didn't use plain words as struct member names ...)
On the TRUNCATE case it's a bit annoying that you can't do it with event
triggers -- you have to create individual regular triggers on truncate
for each table (so you probably need yet another event trigger that
creates such triggers).
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2018-10-01 22:10:53 | Re: Odd 9.4, 9.3 buildfarm failure on s390x |
Previous Message | Andrew Dunstan | 2018-10-01 21:55:36 | Re: Odd 9.4, 9.3 buildfarm failure on s390x |