Re: Discussion: psql \et -> edit the trigger function - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Discussion: psql \et -> edit the trigger function
Date
Msg-id 908211.1683740015@sss.pgh.pa.us
Whole thread Raw
In response to Re: Discussion: psql \et -> edit the trigger function  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Discussion: psql \et -> edit the trigger function
List pgsql-hackers
I wrote:
> Hmm, I wonder how useful that's really going to be, considering
> that trigger names aren't unique across tables.  Wouldn't it
> need to be more like "\et table-name trigger-name"?

Different line of thought: \et seems awfully single-purpose.
Perhaps we should think more of "\st table-name trigger-name"
(show trigger), which perhaps could print something along the
lines of

CREATE TRIGGER after_ins_stmt_trig AFTER INSERT ON main_table
FOR EACH STATEMENT EXECUTE FUNCTION trigger_func('after_ins_stmt');

CREATE FUNCTION public.trigger_func()
 RETURNS trigger
... the rest like \sf for the trigger function

If you indeed want to edit the function, it's a quick copy-and-paste
from here.  But if you just want to see the trigger definition,
this is more wieldy than looking at the whole "\d table-name"
output.  Also we have less of an overloading problem with the
command name.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: createuser --memeber and PG 16
Next
From: Alvaro Herrera
Date:
Subject: de-catalog one error message