pg_get_triggerdef

Started by Christopher Kings-Lynneover 23 years ago5 messagespatches
Jump to latest
#1Christopher Kings-Lynne
chriskl@familyhealth.com.au

This patch creates a function named pg_get_triggerdef that takes the oid of
a trigger as its parameter. It is basically copied from the pg_dump code.

Once we're certain it's perfect, we could probably save some effort in
pg_dump by using the function.

Once it's committed, I will be modifying psql to show trigger definitions,
instead of just the name.

I have tested it with a bunch of different triggers, parameters, constraint
triggers, weird names, different functions, etc and it seems to be OK.

Cheers,

Chris

Attachments:

pg_get_triggerdef.txttext/plain; name=pg_get_triggerdef.txtDownload+186-0
#2Neil Conway
neilc@samurai.com
In reply to: Christopher Kings-Lynne (#1)
Re: pg_get_triggerdef

On Tue, 2003-03-11 at 00:28, Christopher Kings-Lynne wrote:

This patch creates a function named pg_get_triggerdef that takes the oid of
a trigger as its parameter. It is basically copied from the pg_dump code.

+         /*
+          * Find the trigger to delete.
+          */
+         ScanKeyEntryInitialize(&skey[0], 0x0,
+                                ObjectIdAttributeNumber, F_OIDEQ,
+                                ObjectIdGetDatum(trigid));

Looks like you forgot to change this comment :-)

Cheers,

Neil

--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC

#3Neil Conway
neilc@samurai.com
In reply to: Christopher Kings-Lynne (#1)
Re: pg_get_triggerdef

On Tue, 2003-03-11 at 00:28, Christopher Kings-Lynne wrote:

This patch creates a function named pg_get_triggerdef that takes the oid of
a trigger as its parameter. It is basically copied from the pg_dump code.

Oh -- you'll also need to bump the catalog version number.

Cheers,

Neil

--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC

#4Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Christopher Kings-Lynne (#1)
Re: pg_get_triggerdef

On Tue, 2003-03-11 at 00:28, Christopher Kings-Lynne wrote:

This patch creates a function named pg_get_triggerdef that takes the oid

of

a trigger as its parameter. It is basically copied from the pg_dump

code.

Oh -- you'll also need to bump the catalog version number.

Yeah, I normally leave that to the committer - remember to bump Bruce (or
whoever)!

Chris

#5Bruce Momjian
bruce@momjian.us
In reply to: Christopher Kings-Lynne (#1)
Re: pg_get_triggerdef

Newer patch applied with doc patch. Thanks.

---------------------------------------------------------------------------

Christopher Kings-Lynne wrote:

This patch creates a function named pg_get_triggerdef that takes the oid of
a trigger as its parameter. It is basically copied from the pg_dump code.

Once we're certain it's perfect, we could probably save some effort in
pg_dump by using the function.

Once it's committed, I will be modifying psql to show trigger definitions,
instead of just the name.

I have tested it with a bunch of different triggers, parameters, constraint
triggers, weird names, different functions, etc and it seems to be OK.

Cheers,

Chris

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073