From 4b7bba49e71266ec378e672a1aaa9f16823449c2 Mon Sep 17 00:00:00 2001
From: Michael Paquier
Date: Tue, 29 Oct 2024 15:35:01 +0900
Subject: doc: Add better description for rewrite functions in event triggers
There are two functions that can be used in event triggers to get more
details about a rewrite happening on a relation. Both had a limited
documentation:
- pg_event_trigger_table_rewrite_reason() and
pg_event_trigger_table_rewrite_oid() were not mentioned in the main
event trigger section in the paragraph dedicated to the event
table_rewrite.
- pg_event_trigger_table_rewrite_reason() returns an integer which is a
bitmap of the reasons why a rewrite happens. There was no explanation
about the meaning of these values, forcing the reader to look at the
code to find out that these are defined in event_trigger.h.
While on it, let's add a comment in event_trigger.h where the
AT_REWRITE_* are defined, telling to update the documentation when
these values are changed.
Backpatch down to 13 as a consequence of 1ad23335f36b, where this area
of the documentation has been heavily reworked.
Author: Greg Sabino Mullane
Discussion: https://postgr.es/m/CAKAnmmL+Z6j-C8dAx1tVrnBmZJu+BSoc68WSg3sR+CVNjBCqbw@mail.gmail.com
Backpatch-through: 13
---
doc/src/sgml/event-trigger.sgml | 5 +++++
doc/src/sgml/func.sgml | 8 ++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
(limited to 'doc/src')
diff --git a/doc/src/sgml/event-trigger.sgml b/doc/src/sgml/event-trigger.sgml
index d0306390346..cfa7b3d1b2d 100644
--- a/doc/src/sgml/event-trigger.sgml
+++ b/doc/src/sgml/event-trigger.sgml
@@ -104,6 +104,11 @@
control statements are available to rewrite a table,
like CLUSTER and VACUUM,
the table_rewrite event is not triggered by them.
+ To find the OID of the table that was rewritten, use the function
+ pg_event_trigger_table_rewrite_oid() (see
+ ). To discover the reason(s)
+ for the rewrite, use the function
+ pg_event_trigger_table_rewrite_reason().
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 7be0324ac87..05f630c6a6c 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -31687,8 +31687,12 @@ CREATE EVENT TRIGGER test_event_trigger_for_drops
integer
- Returns a code explaining the reason(s) for rewriting. The exact
- meaning of the codes is release dependent.
+ Returns a code explaining the reason(s) for rewriting. The value is
+ a bitmap built from the following values: 1
+ (the table has changed its persistence), 2
+ (default value of a column has changed), 4
+ (a column has a new data type) and 8
+ (the table access method has changed).
--
cgit v1.2.3