From: | Melvin Davidson <melvin6925(at)gmail(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Alex Magnum <magnum11200(at)gmail(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Retrieving comment of rules and triggers |
Date: | 2016-06-09 21:03:17 |
Message-ID: | CANu8FixMHBXsJ0kXPPK7iP=z4P=q2sErQ84B-XZ-irR6rAw0CQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Jun 9, 2016 at 5:01 PM, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> On Thu, Jun 9, 2016 at 4:45 PM, Alex Magnum <magnum11200(at)gmail(dot)com> wrote:
>
>> Hi, is there a way to retrieve the comment of rules and triggers. I
>> worked it out on functions, tables, views but am kind of stuck with rules
>> and triggers.
>>
>
>
> https://www.postgresql.org/docs/devel/static/functions-info.html
>
> Table 9-63. Comment Information Functions
>
> obj_description(object_oid, catalog_name)
>
> Catalog Names:
>
> pg_trigger
> pg_rules
>
> The source catalog for the data is:
>
> pg_description
>
> I'm suspect of your existing solution given that this is supposed to be a
> universal interface for comment data...
>
> David J.
>
>
-- To get all rule comments
SELECT DISTINCT r.rulename,
c.description
FROM pg_rewrite r
JOIN pg_description c ON c.objoid = r.oid;
-- To get all trigger comments
SELECT DISTINCT t.tgname,
c.description
FROM pg_trigger t
JOIN pg_description c ON c.objoid = t.oid;
--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2016-06-09 21:05:53 | Re: Retrieving comment of rules and triggers |
Previous Message | David G. Johnston | 2016-06-09 21:01:22 | Re: Retrieving comment of rules and triggers |