Subject RE: [firebird-support] problems creating constraints
Author Alan McDonald
> I have tried doing this a few times, each attempt has forced me to
> completely remove the entire database and start from scratch.
>
> (i'm migrating from the hell that is mysql so bear with me)
>
> heres what I have
>
> create table users (
> uid integer not null,
> username varchar(32) not null
> );
>
> create table info (
> uid integer not null,
> name integer not null
> );
>
> I add an index and a constraint...
> alter table users add constraint uid primary key (uid);
> create unique index username on users(username);
>
> heres where the problem kicks in:
>
> alter table info add constraint KEY_UID foreign key (uid) references
> users(uid) on update cascade on delete cascade;
>
> unsuccessful metadata update
> -object USERS is in use
>

You need to commit after the first set of metadata updates.
You have a transaction running which does not see the first set of
contraints added.
Alan