pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Patrick Welche <prlw1@newn.cam.ac.uk>
To: Fábio Santana <fabio3c@terra.com.br>
Cc: Hackers Postgresql <pgsql-hackers@postgresql.org>
Subject: Re: RULES
Date: Wed, 21 Nov 2001 12:58:37 +0000
Message-ID: <20011121125837.E21102@quartz.newn.cam.ac.uk> (raw)
In-Reply-To: <001401c1721f$4425b8c0$0100a8c0@fabio3c1>
References: <001401c1721f$4425b8c0$0100a8c0@fabio3c1>

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



view thread (22+ messages)  latest in thread

Message-ID: <20011121125837.E21102@quartz.newn.cam.ac.uk>
Permalink:  ../20011121125837.E21102@quartz.newn.cam.ac.uk/
Also on:    postgresql.org/message-id/20011121125837.E21102@quartz.newn.cam.ac.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: prlw1@newn.cam.ac.uk, fabio3c@terra.com.br, pgsql-hackers@postgresql.org
  Subject: Re: RULES
  In-Reply-To: <20011121125837.E21102@quartz.newn.cam.ac.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox