Received: from henry.newn.cam.ac.uk (henry.newn.cam.ac.uk [131.111.204.130]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fALCwrm34982 for ; Wed, 21 Nov 2001 07:58:54 -0500 (EST) (envelope-from prlw1@newn.cam.ac.uk) Received: from [131.111.204.180] (helo=quartz.newn.cam.ac.uk) by henry.newn.cam.ac.uk with esmtp (Exim 3.13 #1) id 166WxZ-0003Lf-00; Wed, 21 Nov 2001 12:58:37 +0000 Received: from prlw1 by quartz.newn.cam.ac.uk with local (Exim 3.13 #1) id 166WxZ-0005X6-00; Wed, 21 Nov 2001 12:58:37 +0000 Date: Wed, 21 Nov 2001 12:58:37 +0000 From: Patrick Welche To: =?iso-8859-1?Q?F=E1bio?= Santana Cc: Hackers Postgresql Subject: Re: RULES Message-ID: <20011121125837.E21102@quartz.newn.cam.ac.uk> References: <001401c1721f$4425b8c0$0100a8c0@fabio3c1> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <001401c1721f$4425b8c0$0100a8c0@fabio3c1> User-Agent: Mutt/1.3.19i X-Archive-Number: 200111/772 X-Sequence-Number: 15626 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