Обсуждение: RULES

Поиск
Список
Период
Сортировка

RULES

От
Fábio Santana
Дата:
My friends, how i do to get a list of all rules in one table? Thanks!!!!



Re: RULES

От
Patrick Welche
Дата:
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    tgfoid9        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