Re: Table rewrite supporting functions for event triggers

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Table rewrite supporting functions for event triggers
Date: 2024-09-12 22:39:13
Message-ID: ZuNtkd5IJ0TipHzo@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Thu, Sep 12, 2024 at 08:52:00AM -0400, Greg Sabino Mullane wrote:
> I do like the simplicity of the bitmap:
>
> if (reason & 1)
> print "Table has changed from logged to unlogged"
> if (reason & 2)
> print "Default has been changed"
>
> versus with text[]:
>
> foreach reason in tablereason[]
> if reason.match_exact("ALTER_PERSISTENCE")
> print "Table has changed from logged to unlogged"
> if reason.match_regex("DEFAULT")
> print "Default has been changed"
> ...

Okay. I am not going to be annoying with compatibility, then :D

> My initial reaction was that this is indeed a rare case, and to avoid
> putting that level of code detail in the docs. Your argument is a good one,
> but it still feels wrong to put that there. Yes, this puts a little more
> onus on future developers, but updating the docs is already a core
> requirement for patches.
>
> (On reflection, maybe reverse it - put a code comment in event_trigger.h
> reminding people to also update the docs? But again, that's seems like
> something obvious anyway for someone making that change.)

I am not so sure, TBH. One example: I know these values in
tablecmds.c for some time because that's an area I tend to focus on
for bug fixes, but forgot entirely about the SQL function in event
triggers that feed on it until I found your post. A comment in
event_trigger.h to mention the doc update would work for me. That
would be impossible to miss.
--
Michael

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Oleg Sibiryakov 2024-09-13 10:50:14 Re: Documentation improvement patch
Previous Message Greg Sabino Mullane 2024-09-12 12:52:00 Re: Table rewrite supporting functions for event triggers