Subject Re: [firebird-support] Indexe's on Keys
Author Helen Borrie
At 01:53 PM 17/03/2004 +0200, you wrote:
>As far as I know everytime I create a table with a primary key or a foreign
>key automatically an idnex is created for them. Now I read somewhere , I
>don't remember where , either in the forum or in one of the many Firebird
>builds documentation that I can define this index creation or at least the
>name that the index gets. How do I do that given the table examle below ?
>Or must I create the table and then rename the index. Or where can I find
>documentation about this ?
>
>CREATE TABLE Country
>(
>CountryIDSQ INTEGER NOT NULL ,
>CountryName VARCHAR(50) NOT NULL ,
>CountryInternationlCode VARCHAR(10) DEFAULT '00' NOT NULL ,
>CountryCode VARCHAR(10) NOT NULL ,
>CountryAreaCode VARCHAR(10) ,
>CountryTimeZoneDifference VARCHAR(20) ,
>CountryHelpNumber VARCHAR(8) ,
>PRIMARY KEY (CountryIDSQ) ,
>UNIQUE (CountryName)
>) ;

In Firebird 1.5 (not 1.0.x):
CONSTRAINT MyPk PRIMARY KEY (CountryIDSQ)
will give you both the constraint and the index having the same name (MyPk).

CONSTRAINT MyPk PRIMARY KEY (CountryIDSQ)
USING DESC INDEX MyPkIndex

will give you constraint name MyPK, and a descending unique index named
MyPkIndex

(DESC is optional, of course. If you use it, any foreign keys that refer
to it must be DESC also..

Have you thought about reading the release notes? You can get them in
German, you know. (and Spanish, Italian, Czech, two dialects of Portuguese...)

/heLen