Re: New Event Trigger: table_rewrite - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: New Event Trigger: table_rewrite
Date
Msg-id 20141120021730.GH1639@alvin.alvh.no-ip.org
Whole thread Raw
In response to Re: New Event Trigger: table_rewrite  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: New Event Trigger: table_rewrite  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
List 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



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Next
From: Peter Eisentraut
Date:
Subject: Re: Bugfix and new feature for PGXS