From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Yotsunaga, Naoki <yotsunaga.naoki@jp.fujitsu.com>
Cc: Postgres hackers <pgsql-hackers@postgresql.org>
Subject: Re: automatic restore point
Date: Mon, 1 Oct 2018 16:43:09 +0200
Message-ID: <544ca174-f0a1-fe75-ce74-3625fbc09447@2ndquadrant.com> (raw)
In-Reply-To: <20181001033423.xtc7jckr74good2n@alvherre.pgsql>
References: <20181001033423.xtc7jckr74good2n@alvherre.pgsql>
On 01/10/2018 05:34, Alvaro Herrera wrote:
> I don't see it as clear cut as all that ... particularly considering
> that a useful event trigger runs *after* the DDL command in question has
> already written all its WAL, so such a restore point would be completely
> useless. (Or are ddl_command_start event triggers useful enough?)
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?
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com, alvherre@2ndquadrant.com, michael@paquier.xyz, yotsunaga.naoki@jp.fujitsu.com
Subject: Re: automatic restore point
In-Reply-To: <544ca174-f0a1-fe75-ce74-3625fbc09447@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox