Subject Re: Modify Primary key
Author skotaylor
--- In firebird-support@yahoogroups.com, "Alexander V.Nevsky"
<ded@h...> wrote:
> --- In firebird-support@yahoogroups.com, "skotaylor" <scott@d...>
> wrote:
> > I need to add another field to a primary key on a live database. I
> > added the record to the RDB$INDEX_SEGMENTS and all looks good except
>
> Scott, I'm amazing why people don't like broad, paved with asphalt
> roads and prefer circuitous wild pathes :)

I'm just a circuitously wild guy ;)

Besides, I couldn't locat the proper syntax and everything else I
tried just popped up errors.

> Why not just
>
> Alter Table T Drop Constraint T_PK;
> Commit;
> Alter Table T Add Constraint T_PK Primary Key (OldCol, NewCol);
> Commit;

What does T_PK stand for?

I tried:
alter table fuellog drop constraint INTEG_68

and I get
ISC ERROR CODE:335544351

ISC ERROR MESSAGE:
unsuccessful metadata update
object INDEX is in use

> if you have FKs on another tables references on this PK, you should
> drop them before dropping it and re-create after creation new one.

No, none.

> Anyway, you should change them too. Perhaps you'll be forced to
> reconnect several times due to "object in use" exception.

hmmm... Like the error I got. I know it's not in use, currently, but
tried many times as you said; still no luck.

> Hacks of
> system table is last what reasonables person should try to do, use
> documented ways.

I would if I could find the document that tells me how to do this. I
have all the ib_IB6_docs .pdf files from ibphoenix site and the SQL
ref.html one as well. Maybe I just getting the syntax messed up?

Maybe I need to have exclusive access to alter a primary key, is this
true?

Cheers.

Scott.