Re: Table rewrite supporting functions for event triggers

2024-10-29 Thread Michael Paquier
On Fri, Sep 13, 2024 at 07:39:13AM +0900, Michael Paquier wrote: > 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

Re: Table rewrite supporting functions for event triggers

2024-09-12 Thread Michael Paquier
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 tablereaso

Re: Table rewrite supporting functions for event triggers

2024-09-12 Thread Greg Sabino Mullane
On Wed, Sep 11, 2024 at 11:17 PM Michael Paquier wrote: > If multiple are set, let's just make it text[], then. > Hmmm...I guess it's better than an integer, in some ways, but I'm still a weak -1. > That would be a step backwards for anyone possibly using that integer > > programatically to (fo

Re: Table rewrite supporting functions for event triggers

2024-09-11 Thread Michael Paquier
On Wed, Sep 11, 2024 at 10:14:27AM -0400, Greg Sabino Mullane wrote: > I dunno - so would we smush them together and return something like: > > "ALTER_PERSISTENCE and COLUMN_REWRITE" If multiple are set, let's just make it text[], then. > That would be a step backwards for anyone possibly using

Re: Table rewrite supporting functions for event triggers

2024-09-11 Thread Greg Sabino Mullane
On Wed, Sep 11, 2024 at 2:00 AM Michael Paquier wrote: > Putting the documentation change aside for a bit, could it be better > to redesign this function and return a text value rather than an > integer? We could directly return the names, minus "AT_REWRITE_", for > instance. > I dunno - so wo

Re: Table rewrite supporting functions for event triggers

2024-09-10 Thread Michael Paquier
On Tue, Sep 03, 2024 at 09:34:02PM +0200, Laurenz Albe wrote: > On Tue, 2024-09-03 at 11:54 -0400, Greg Sabino Mullane wrote: >> How about something like this? > > This patch looks good to me. -Returns a code explaining the reason(s) for rewriting. The exact -meaning of the codes

Re: Table rewrite supporting functions for event triggers

2024-09-03 Thread Laurenz Albe
On Tue, 2024-09-03 at 11:54 -0400, Greg Sabino Mullane wrote: > How about something like this? This patch looks good to me. Yours, Laurenz Albe

Re: Table rewrite supporting functions for event triggers

2024-09-03 Thread Greg Sabino Mullane
How about something like this? I realize the other functions in that section are not linked, but they all seem pretty self-explanatory compared to the mysterious int return value of the linked one. Cheers, Greg 0002-Document-the-event-trigger-table-rewrite-functions.patch Description: Binary dat

Re: Table rewrite supporting functions for event triggers

2024-09-03 Thread Greg Sabino Mullane
On Mon, Sep 2, 2024 at 9:57 PM Laurenz Albe wrote: > I think that it would be better to add a reference to > > https://www.postgresql.org/docs/16/functions-event-triggers.html#FUNCTIONS-EVENT-TRIGGER-TABLE-REWRITE > than to repeat that information. > > If you feel that "The exact meaning of the c

Re: Table rewrite supporting functions for event triggers

2024-09-02 Thread Laurenz Albe
On Mon, 2024-09-02 at 17:15 -0400, Greg Sabino Mullane wrote: > While looking over the event trigger docs, I noticed that the sample code > references > the two special table rewrite functions (returning oid and reason for the > rewrite), > but the event trigger page itself does not mention them,

Table rewrite supporting functions for event triggers

2024-09-02 Thread Greg Sabino Mullane
While looking over the event trigger docs, I noticed that the sample code references the two special table rewrite functions (returning oid and reason for the rewrite), but the event trigger page itself does not mention them, although it does mention the functions available for the other types of e