Thread: Re: How can I view the definition of an existing trigger?

Re: How can I view the definition of an existing trigger?

From
wsheldah@lexmark.com
Date:

Thanks for the reply.  I checked pg_trigger, but it only seems to have
information *about* the trigger, and not the actual text of the trigger command.
As far as I can tell, the only way for me to hang on to trigger definitions is
to put the create trigger commands in a file that I then source into psql.  As
for triggers already created, my best bet may be to drop what's there and
recreate it so I know exactly what it does.  Unless anyone has a better idea....




Justin Clift <justin%postgresql.org@interlock.lexmark.com> on 08/11/2001
04:59:52 PM

To:   "Wesley_Sheldahl/Lex/Lexmark.LEXMARK"@sweeper.lex.lexmark.com
cc:    (bcc: Wesley Sheldahl/Lex/Lexmark)
Subject:  Re: [GENERAL] How can I view the definition of an existing trigger?


Hi Wes,

Not sure exactly, but in theory it would be stored in one of
PostgreSQL's special pg_* tables.  So, also in theory, if you can
isolate where they're stored, you might be able to find it.

:-)

Regards and best wishes,

Justin Clift


wsheldah@lexmark.com wrote:
>
> Is there any way short of a full database dump to view the "CREATE TRIGGER"
> statement of a trigger after it's been created, preferable via a command line
> tool like psql?  Is it accessible via any of the GUI tools out there?  Thanks,
>
> Wes
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
   - Indira Gandhi





Re: How can I view the definition of an existing trigger?

From
Ryan Mahoney
Date:
Use pg_dump to dump your schema as a text file
(/usr/local/pgsql/bin/pg_dump -s > my_schema.sql).  This text file should
contain *all* of the data that creates the schema of your database,
including triggers and stored procedures.  I think this should work  ;)

-Ryan

At 09:18 AM 8/13/01 -0400, wsheldah@lexmark.com wrote:



>Thanks for the reply.  I checked pg_trigger, but it only seems to have
>information *about* the trigger, and not the actual text of the trigger
>command.
>As far as I can tell, the only way for me to hang on to trigger definitions is
>to put the create trigger commands in a file that I then source into psql.  As
>for triggers already created, my best bet may be to drop what's there and
>recreate it so I know exactly what it does.  Unless anyone has a better
>idea....
>
>
>
>
>Justin Clift <justin%postgresql.org@interlock.lexmark.com> on 08/11/2001
>04:59:52 PM
>
>To:   "Wesley_Sheldahl/Lex/Lexmark.LEXMARK"@sweeper.lex.lexmark.com
>cc:    (bcc: Wesley Sheldahl/Lex/Lexmark)
>Subject:  Re: [GENERAL] How can I view the definition of an existing trigger?
>
>
>Hi Wes,
>
>Not sure exactly, but in theory it would be stored in one of
>PostgreSQL's special pg_* tables.  So, also in theory, if you can
>isolate where they're stored, you might be able to find it.
>
>:-)
>
>Regards and best wishes,
>
>Justin Clift
>
>
>wsheldah@lexmark.com wrote:
> >
> > Is there any way short of a full database dump to view the "CREATE TRIGGER"
> > statement of a trigger after it's been created, preferable via a
> command line
> > tool like psql?  Is it accessible via any of the GUI tools out
> there?  Thanks,
> >
> > Wes
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
>
>--
>"My grandfather once told me that there are two kinds of people: those
>who work and those who take the credit. He told me to try to be in the
>first group; there was less competition there."
>    - Indira Gandhi
>
>
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/users-lounge/docs/faq.html
>
>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.251 / Virus Database: 124 - Release Date: 4/26/01

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.251 / Virus Database: 124 - Release Date: 4/26/01

Re: How can I view the definition of an existing trigger?

From
Bernie Holmes
Date:
Wes,

Is this the kind of "trigger text" data you were interested in?

select relname as table_name,
       tgname  as trigger_name,
       tgtype  as trigger_type,
       proname as trigger_function
from   pg_class, pg_trigger, pg_proc
where  pg_class.oid = tgrelid
and    tgfoid = pg_proc.oid
and    tgisconstraint = 'f'
order by table_name, trigger_name;

Bernie

wsheldah@lexmark.com wrote:

>
>Thanks for the reply.  I checked pg_trigger, but it only seems to have
>information *about* the trigger, and not the actual text of the trigger command.
>As far as I can tell, the only way for me to hang on to trigger definitions is
>to put the create trigger commands in a file that I then source into psql.  As
>for triggers already created, my best bet may be to drop what's there and
>recreate it so I know exactly what it does.  Unless anyone has a better idea....
>
>
>
>
>Justin Clift <justin%postgresql.org@interlock.lexmark.com> on 08/11/2001
>04:59:52 PM
>
>To:   "Wesley_Sheldahl/Lex/Lexmark.LEXMARK"@sweeper.lex.lexmark.com
>cc:    (bcc: Wesley Sheldahl/Lex/Lexmark)
>Subject:  Re: [GENERAL] How can I view the definition of an existing trigger?
>
>
>Hi Wes,
>
>Not sure exactly, but in theory it would be stored in one of
>PostgreSQL's special pg_* tables.  So, also in theory, if you can
>isolate where they're stored, you might be able to find it.
>
>:-)
>
>Regards and best wishes,
>
>Justin Clift
>
>
>wsheldah@lexmark.com wrote:
>
>>Is there any way short of a full database dump to view the "CREATE TRIGGER"
>>statement of a trigger after it's been created, preferable via a command line
>>tool like psql?  Is it accessible via any of the GUI tools out there?  Thanks,
>>
>>Wes
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 4: Don't 'kill -9' the postmaster
>>
>
>--
>"My grandfather once told me that there are two kinds of people: those
>who work and those who take the credit. He told me to try to be in the
>first group; there was less competition there."
>   - Indira Gandhi
>
>
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/users-lounge/docs/faq.html
>