Foreign Key 'walker'?
От | Erwin Moller |
---|---|
Тема | Foreign Key 'walker'? |
Дата | |
Msg-id | 4922D568.2090408@darwine.nl обсуждение исходный текст |
Ответы |
Re: Foreign Key 'walker'?
Re: Foreign Key 'walker'? |
Список | pgsql-general |
Hi group, Considering following (simplified) example: CREATE TABLE tblnr1( nr1id SERIAL PRIMARY KEY, firstname TEXT ); CREATE TABLE tblnr2( nr2id SERIAL PRIMARY KEY, nr1id INTEGER REFERENCES tblnr1(nr1id) ); CREATE TABLE tblnr3( nr3id SERIAL PRIMARY KEY, nr2id INTEGER REFERENCES tblnr2(nr2id) ); Suppose I want to delete a record in tblnr1. Does Postgres has some command/procedure/function to list tables that have FK constraints on that table (tblnr1) and lists also the tables that have a FK constraint on tables that have a FK constraint on the first? etc. So I would like some kind of FK 'walker'. I want this because: 1) I hate DELETE CASCADE because I am chicken (So I use a script to delete all related records in the right order in a transaction) 2) I have a lot of tables and am afraid I miss some. And I am also a bit lazy .-) Thanks for your time. Regards, Erwin Moller
В списке pgsql-general по дате отправления: