Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4b7bba4

Browse files
committed
doc: Add better description for rewrite functions in event triggers
There are two functions that can be used in event triggers to get moredetails about a rewrite happening on a relation. Both had a limiteddocumentation:- pg_event_trigger_table_rewrite_reason() andpg_event_trigger_table_rewrite_oid() were not mentioned in the mainevent trigger section in the paragraph dedicated to the eventtable_rewrite.- pg_event_trigger_table_rewrite_reason() returns an integer which is abitmap of the reasons why a rewrite happens. There was no explanationabout the meaning of these values, forcing the reader to look at thecode to find out that these are defined in event_trigger.h.While on it, let's add a comment in event_trigger.h where theAT_REWRITE_* are defined, telling to update the documentation whenthese values are changed.Backpatch down to 13 as a consequence of1ad2333, where this areaof the documentation has been heavily reworked.Author: Greg Sabino MullaneDiscussion:https://postgr.es/m/CAKAnmmL+Z6j-C8dAx1tVrnBmZJu+BSoc68WSg3sR+CVNjBCqbw@mail.gmail.comBackpatch-through: 13
1 parentdda7816 commit4b7bba4

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

‎doc/src/sgml/event-trigger.sgml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@
104104
control statements are available to rewrite a table,
105105
like <literal>CLUSTER</literal> and <literal>VACUUM</literal>,
106106
the <literal>table_rewrite</literal> event is not triggered by them.
107+
To find the OID of the table that was rewritten, use the function
108+
<literal>pg_event_trigger_table_rewrite_oid()</literal> (see
109+
<xref linkend="functions-event-triggers"/>). To discover the reason(s)
110+
for the rewrite, use the function
111+
<literal>pg_event_trigger_table_rewrite_reason()</literal>.
107112
</para>
108113

109114
<para>

‎doc/src/sgml/func.sgml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31687,8 +31687,12 @@ CREATE EVENT TRIGGER test_event_trigger_for_drops
3168731687
<returnvalue>integer</returnvalue>
3168831688
</para>
3168931689
<para>
31690-
Returns a code explaining the reason(s) for rewriting. The exact
31691-
meaning of the codes is release dependent.
31690+
Returns a code explaining the reason(s) for rewriting. The value is
31691+
a bitmap built from the following values: <literal>1</literal>
31692+
(the table has changed its persistence), <literal>2</literal>
31693+
(default value of a column has changed), <literal>4</literal>
31694+
(a column has a new data type) and <literal>8</literal>
31695+
(the table access method has changed).
3169231696
</para></entry>
3169331697
</row>
3169431698
</tbody>

‎src/include/commands/event_trigger.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ typedef struct EventTriggerData
3131

3232
externPGDLLIMPORTboolevent_triggers;
3333

34+
/*
35+
* Reasons for relation rewrites.
36+
*
37+
* pg_event_trigger_table_rewrite_reason() uses these values, so make sure to
38+
* update the documentation when changing this list.
39+
*/
3440
#defineAT_REWRITE_ALTER_PERSISTENCE0x01
3541
#defineAT_REWRITE_DEFAULT_VAL0x02
3642
#defineAT_REWRITE_COLUMN_REWRITE0x04

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp