Re: [PATCH] Add pretty formatting to pg_get_triggerdef

2025-11-06 Thread Philip Alger
Hi Tom, > This patch will cause psql's \d to fail hard against any pre-v19 > server. That's not acceptable. Note the comment at the top of > describe.c: > > * Support for the various \d ("describe") commands. Note that the current > * expectation is that all functions in this file will succ

Re: [PATCH] Add pretty formatting to pg_get_triggerdef

2025-11-05 Thread Tom Lane
Philip Alger writes: > I am attaching v3. This patch will cause psql's \d to fail hard against any pre-v19 server. That's not acceptable. Note the comment at the top of describe.c: * Support for the various \d ("describe") commands. Note that the current * expectation is that all functions

Re: [PATCH] Add pretty formatting to pg_get_triggerdef

2025-11-05 Thread Philip Alger
I am attaching v3. I changed the name of the function that prints out the trigger using the \d command (below) from `pg_get_triggerdef_compact` to `pg_get_triggerdef_string`, which matches the index naming convention for a similar function. postgres=# \d child3 >Table "public.chil

Re: [PATCH] Add pretty formatting to pg_get_triggerdef

2025-11-05 Thread Philip Alger
Hi Chao, > > I think this is a mis-use of PRETTYFLAG_SCHEMA that is for printing > schema-qualified names but omitting schema. > > > > Yes, this is to omit the schema because the functions is used to print > out the triggers when using \d in psql, The current practice isn't to print > out a schem

Re: [PATCH] Add pretty formatting to pg_get_triggerdef

2025-11-05 Thread Chao Li
> On Nov 5, 2025, at 04:56, Philip Alger wrote: > > Hi Chao, > > +/* > + * pg_get_triggerdef_compact > + * Returns trigger definition in a compact, single-line format > without > + * schema qualification designed for the psql \d command. > + */ > +Datum > +pg_get_trig

Re: [PATCH] Add pretty formatting to pg_get_triggerdef

2025-11-04 Thread Philip Alger
Hi Chao, +/* > + * pg_get_triggerdef_compact > + * Returns trigger definition in a compact, single-line > format without > + * schema qualification designed for the psql \d command. > + */ > +Datum > +pg_get_triggerdef_compact(PG_FUNCTION_ARGS) > +{ > + Oid

Re: [PATCH] Add pretty formatting to pg_get_triggerdef

2025-11-04 Thread Chao Li
> On Nov 4, 2025, at 11:36, Philip Alger wrote: > > -- > Best, > Phil Alger > 1 ``` +/* + * pg_get_triggerdef_compact + * Returns trigger definition in a compact, single-line format without + * schema qualification designed for the psql \d command. + */ +Datum +pg_

Re: [PATCH] Add pretty formatting to pg_get_triggerdef

2025-11-03 Thread Steven Niu
PATCH] Add pretty formatting to pg_get_triggerdef Hello Hackers, Currently, `pg_get_triggerdef` includes a "pretty" flag, but it does not actually format the `CREATE TRIGGER` statement in a "pretty" way. Unlike `pg_get_viewdef`, `pg_get_ruledef`, and `pg_get_indexdef`, the pur

[PATCH] Add pretty formatting to pg_get_triggerdef

2025-11-03 Thread Philip Alger
Hello Hackers, Currently, `pg_get_triggerdef` includes a "pretty" flag, but it does not actually format the `CREATE TRIGGER` statement in a "pretty" way. Unlike `pg_get_viewdef`, `pg_get_ruledef`, and `pg_get_indexdef`, the purpose of pretty formatting has been to remove the schema name so it can