Re: New Event Trigger: table_rewrite

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New Event Trigger: table_rewrite
Date: 2014-11-20 02:17:30
Message-ID: 20141120021730.GH1639@alvin.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier wrote:

> 1) Couldn't this paragraph be reworked?
> <para>
> + The <literal>table_rewrite</> event occurs just before a table is going to
> + get rewritten by the commands <literal>ALTER TABLE</literal>. While other
> + control statements are available to rewrite a table,
> + like <literal>CLUSTER</literal> and <literal>VACUUM</literal>,
> + the <literal>table_rewrite</> event is currently only triggered by
> + the <literal>ALTER TABLE</literal> command, which might or might not need
> + to rewrite the table.
> + </para>
> CLUSTER and VACUUM are not part of the supported commands anymore, so
> I think that we could replace that by the addition of a reference
> number in the cell of ALTER TABLE for the event table_rewrite and
> write at the bottom of the table a description of how this event
> behaves with ALTER TABLE. Note as well that "might or might not" is
> not really helpful for the user.

That's precisely why we have an event trigger here, I think --- for some
subcommands, it's not easy to determine whether a rewrite happens or
not. (I think SET TYPE is the one). I don't think we want to document
precisely under what condition a rewrite takes place.

> 2) The examples of SQL queries provided are still in lower case in the
> docs, that's contrary to the rest of the docs where upper case is used
> for reserved keywords.
> + <para>
> + Here's an example implementing such a policy.
> +<programlisting>
> +create or replace function no_rewrite()
> + returns event_trigger
> + language plpgsql as

Yes please. <nitpick> Another thing in that sample code is "not current_hour
between 1 and 6". That reads strange to me. It should be equally
correct to spell it as "current_hour not between 1 and 6", which seems
more natural. </>

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2014-11-20 03:25:08 Re: Bugfix and new feature for PGXS
Previous Message Peter Geoghegan 2014-11-20 02:10:02 Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}