Re: foreign keys
От | Radoslaw Stachowiak |
---|---|
Тема | Re: foreign keys |
Дата | |
Msg-id | 20000807120320.A23749@blue.alter.pl обсуждение исходный текст |
Ответ на | Re: foreign keys (Stephan Szabo <sszabo@megazone23.bigpanda.com>) |
Ответы |
Re: foreign keys
(Stephan Szabo <sszabo@megazone23.bigpanda.com>)
|
Список | pgsql-general |
*** Stephan Szabo <sszabo@megazone23.bigpanda.com> [Sunday, 06.August.2000, 14:26 -0700]: > > Actually, you should only be seeing one constraint out on the referencing > table and two out of the referenced one, but yes, fundamentally it only is > dumping the constraint triggers for the table you are dumping at the > moment. ok, but let's talk about number of constraints. I think that the correct number (for my meaning of full foreign key) is 4. 2 for both tables: referenced: UPDATE contrains AND DELETE constraint referencing: INSERT constraint AND UPDATE constraint am I right? > > What is correct (mean: most simple) way of dupicating table with all FK ? > > Umm, possibly taking the dump of the table you want and a schema only > dump of the referenced table and removing the bits you don't need. > > Or, turn the constraint triggers into alter table add constraint > statements (although you'd then have to only get one alter table add > constraint in case you were on the referenced table - and that could > still get you in trouble depending on what precisely you're doing -- > if the table was the referenced table of a fk constraint, would you > necessarily want to alter the table that was referencing it?). [.rs.] my english is not so good for such complicated sentences :) what i need/try to accomplish is to full dump/recreate/modify of table with all needed (applied) constraints. Primiary I thought only about referencing table but now I know that "prescription" should also mention operation on referenced table. In short: 1. how to full duplicate/modify table (referencing) 2. how to full duplicate/modify table (referenced) It should take care of fact that it should at start DESTROY table and all constraints (on both tables!!!) and than recreate it from scratch - this is needed to satisfy the modify case (someone may need to changee FK schema to sth different). How can I manipulate existing unnamed (created automaticly by foreign key) constraints on tables in PSQL tool ? -- radoslaw.stachowiak.........................................http://alter.pl/
В списке pgsql-general по дате отправления: