Re: How to see a RULE definition?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Josh Goodman <jogoodma(at)lanl(dot)gov>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to see a RULE definition?
Date: 2001-01-11 16:57:58
Message-ID: 11755.979232278@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Josh Goodman <jogoodma(at)lanl(dot)gov> writes:
> ... I was able to figure out that all the rules
> for a particular DB are stored in the pg_rewrite table but that seems
> almost unreadable for a human. What I would like is a command that spits
> out the create syntax I used when the rule was first created.

See the (woefully undocumented) pg_get_ruledef() function. pg_dump uses
this.

> On that
> same line of thinking, is there a command to get a list of all rules that
> have been put on a table?

A join of pg_rewrite against pg_class should do it for you ...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Trewern, Ben 2001-01-11 17:01:08 Recall: How to see a RULE definition?
Previous Message Trewern, Ben 2001-01-11 16:54:56 RE: How to see a RULE definition?