On 06/09/2018 02:16, Yotsunaga, Naoki wrote: > -----Original Message----- > From: Yotsunaga, Naoki [mailto:yotsunaga.na...@jp.fujitsu.com] > Sent: Tuesday, June 26, 2018 10:18 AM > To: Postgres hackers <pgsql-hack...@postgresql.org> > Subject: automatic restore point > >> Hi, I attached a patch to output the LSN before execution to the server log >> >when executing a specific command and accidentally erasing data. > > Since there was an error in the attached patch, I attached the modified patch.
I think this should be done using event triggers. Right now, you just have it hardcoded to TRUNCATE and DROP TABLE, which seems somewhat arbitrary. With event triggers, you have the full flexibility to do what you want. You can pick which commands to apply it to, you can log the LSN, you can create restore points, etc. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services