[prev in list] [next in list] [prev in thread] [next in thread]
List: turbine-torque-dev
Subject: Re: Order of table dropping
From: Tobias Downer <toby () mckoi ! com>
Date: 2002-06-25 14:12:35
[Download RAW message or body]
Sam Joseph wrote:
>
> On the Mckoi side - what happens if two tables have foreign key
> relations to each other - can they never be dropped?
>
Sam,
In Mckoi, the DROP TABLE query accepts multiple tables so you can use
that to drop tables that reference each other. For example,
create table t1 ( pk integer, fk integer, primary key ( pk ) );
create table t2 ( pk integer, fk integer, primary key ( pk ) );
alter table t1 add foreign key ( fk ) references t2;
alter table t2 add foreign key ( fk ) references t1;
drop table t1; <-- fails
drop table t2; <-- fails
drop table t1, t2; <-- works
I don't think this is a standard SQL feature however. If you want
something that is more cross-DB compatible I would recommend using
Bernard's suggestion and dropping the foreign key constraints before
dropping the table.
Toby.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic