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

Commit93a596c

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 parentee8db41 commit93a596c

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@
8080
control statements are available to rewrite a table,
8181
like <literal>CLUSTER</literal> and <literal>VACUUM</literal>,
8282
the <literal>table_rewrite</literal> event is not triggered by them.
83+
To find the OID of the table that was rewritten, use the function
84+
<literal>pg_event_trigger_table_rewrite_oid()</literal> (see
85+
<xref linkend="functions-event-triggers"/>). To discover the reason(s)
86+
for the rewrite, use the function
87+
<literal>pg_event_trigger_table_rewrite_reason()</literal>.
8388
</para>
8489

8590
<para>

‎doc/src/sgml/func.sgml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26786,8 +26786,11 @@ CREATE EVENT TRIGGER test_event_trigger_for_drops
2678626786
<returnvalue>integer</returnvalue>
2678726787
</para>
2678826788
<para>
26789-
Returns a code explaining the reason(s) for rewriting. The exact
26790-
meaning of the codes is release dependent.
26789+
Returns a code explaining the reason(s) for rewriting. The value is
26790+
a bitmap built from the following values: <literal>1</literal>
26791+
(the table has changed its persistence), <literal>2</literal>
26792+
(default value of a column has changed) and <literal>4</literal>
26793+
(a column has a new data type).
2679126794
</para></entry>
2679226795
</row>
2679326796
</tbody>

‎src/include/commands/event_trigger.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ typedef struct EventTriggerData
2929
CommandTagtag;
3030
}EventTriggerData;
3131

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp