Re: RULES

From: Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk>
To: Fábio Santana <fabio3c(at)terra(dot)com(dot)br>
Cc: Hackers Postgresql <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RULES
Date: 2001-11-21 12:58:37
Message-ID: 20011121125837.E21102@quartz.newn.cam.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

On Tue, Nov 20, 2001 at 08:56:55PM -0300, Fábio Santana wrote:
> My friends, how i do to get a list of all rules in one table? Thanks!!!!

select rulename,definition from pg_rules where tablename='YourTable';

(Don't have any defined, so can't check)

I have a similar question on triggers:

create table a (
id integer primary key
);

create table b (
a_id integer references a(id) match full
);

select * from pg_trigger where tgname ~* '^RI_';

Gives me 3 rows. They all contain the same tgargs. Is it therefore
sufficient to select distinct tgnargs,tgargs if I just want to be able to
recreate the "references... match full" part of the create table statement?

It seems that the rows differ in

tgtype tgrelid tgconstrrelid tgfoid
9 table a table b RI_FKey_noaction_del
17 table a table b RI_FKey_noaction_upd
21 table b table a RI_FKey_check_ins

9=row,delete, 17=row,update, 21=row,insert,update ?

Why are the first 2 constraints there? It seems to be the last one which
says "If I insert,update table b, check it is a valid entry with table a"

Is that right?

Patrick

In response to

  • RULES at 2001-11-20 23:56:55 from Fábio Santana

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Seung Hyun Jeong 2001-11-21 13:19:39 about call-convention in PostgreSQL programming
Previous Message mlw 2001-11-21 11:58:10 Re: postgresql.conf (Proposed settings)

Browse pgsql-sql by date

  From Date Subject
Next Message Fernández Mariano 2001-11-21 13:35:50 Stored Procedure
Previous Message Markus Bertheau 2001-11-21 11:57:59 Re: Joins~