CREATION OF PRIMARY KEYS

Started by Andy Hallamover 24 years ago4 messagesgeneral
Jump to latest
#1Andy Hallam
ahm@exel.co.uk

Hi all.

I'm trying to create a PRIMARY KEY on a table I've created but am not having
any success.

TABLE SCHEMA SQL = :

CREATE TABLE X (XCOL CHAR(10))

When I execute either of the below 2 ALTER TABLE commands:

ALTER TABLE X ADD CONSTRAINT PK_X PRIMARY KEY (XCOL)
or
ALTER TABLE X ADD PRIMARY KEY (XCOL)

I keep getting the following error message:

ERROR: ALTER TABLE/ ADD CONSTRAINT is not implemented for that constraint
type. (State:S1000, Native Code: 7)

Can't find anything in the documentation?

Any ideas ?

thanks.

Andy
ahm@exel.co.uk

#2Szabo Zoltan
col@econet.hu
In reply to: Andy Hallam (#1)
Re: CREATION OF PRIMARY KEYS

Manual says:
"(But a primary key cannot be added after table creation.)"

http://www.postgresql.org/idocs/index.php?indices-unique.html

If you do not read manual, or do not search, probably you can't read what is
written there ;)

CoL

Andy Hallam wrote:

Hi all.

I'm trying to create a PRIMARY KEY on a table I've created but am not having
any success.

TABLE SCHEMA SQL = :

CREATE TABLE X (XCOL CHAR(10))

When I execute either of the below 2 ALTER TABLE commands:

ALTER TABLE X ADD CONSTRAINT PK_X PRIMARY KEY (XCOL)
or
ALTER TABLE X ADD PRIMARY KEY (XCOL)

I keep getting the following error message:

ERROR: ALTER TABLE/ ADD CONSTRAINT is not implemented for that constraint
type. (State:S1000, Native Code: 7)

Can't find anything in the documentation?

Any ideas ?

thanks.

Andy
ahm@exel.co.uk

--
[ Szabo Zoltan ]
[ software fejleszto ]
[ econet.hu Informatikai Rt. ]
[ 1117 Budapest, Hauszmann A. u. 3. ]
[ tel.: 371 2100 fax: 371 2101 ]

#3Andy Hallam
ahm@exel.co.uk
In reply to: Andy Hallam (#1)
Re: CREATION OF PRIMARY KEYS

Very helpful that.

What I meant by 'Can't find anything in the documentation' is I can't find
anything in the documentation (i.e SYNTAX wise) on how you do this at table
creation.

Thanks in advance to anyone with any help on this.

Andy.

"Szabo Zoltan" <col@econet.hu> wrote in message
news:3BB337E9.7B304318@econet.hu...

Manual says:
"(But a primary key cannot be added after table creation.)"

http://www.postgresql.org/idocs/index.php?indices-unique.html

If you do not read manual, or do not search, probably you can't read what

is

written there ;)

CoL

Andy Hallam wrote:

Hi all.

I'm trying to create a PRIMARY KEY on a table I've created but am not

having

any success.

TABLE SCHEMA SQL = :

CREATE TABLE X (XCOL CHAR(10))

When I execute either of the below 2 ALTER TABLE commands:

ALTER TABLE X ADD CONSTRAINT PK_X PRIMARY KEY (XCOL)
or
ALTER TABLE X ADD PRIMARY KEY (XCOL)

I keep getting the following error message:

ERROR: ALTER TABLE/ ADD CONSTRAINT is not implemented for that

constraint

Show quoted text

type. (State:S1000, Native Code: 7)

Can't find anything in the documentation?

Any ideas ?

thanks.

Andy
ahm@exel.co.uk

--
[ Szabo Zoltan ]
[ software fejleszto ]
[ econet.hu Informatikai Rt. ]
[ 1117 Budapest, Hauszmann A. u. 3. ]
[ tel.: 371 2100 fax: 371 2101 ]

#4Andy Hallam
ahm@exel.co.uk
In reply to: Andy Hallam (#1)
Re: CREATION OF PRIMARY KEYS

Thankyou, I have now resolved this issue.

"Andy Hallam" <ahm@exel.co.uk> wrote in message
news:9ovhej$1kt$1@news.tht.net...

Very helpful that.

What I meant by 'Can't find anything in the documentation' is I can't find
anything in the documentation (i.e SYNTAX wise) on how you do this at

table

creation.

Thanks in advance to anyone with any help on this.

Andy.

"Szabo Zoltan" <col@econet.hu> wrote in message
news:3BB337E9.7B304318@econet.hu...

Manual says:
"(But a primary key cannot be added after table creation.)"

http://www.postgresql.org/idocs/index.php?indices-unique.html

If you do not read manual, or do not search, probably you can't read

what

Show quoted text

is

written there ;)

CoL

Andy Hallam wrote:

Hi all.

I'm trying to create a PRIMARY KEY on a table I've created but am not

having

any success.

TABLE SCHEMA SQL = :

CREATE TABLE X (XCOL CHAR(10))

When I execute either of the below 2 ALTER TABLE commands:

ALTER TABLE X ADD CONSTRAINT PK_X PRIMARY KEY (XCOL)
or
ALTER TABLE X ADD PRIMARY KEY (XCOL)

I keep getting the following error message:

ERROR: ALTER TABLE/ ADD CONSTRAINT is not implemented for that

constraint

type. (State:S1000, Native Code: 7)

Can't find anything in the documentation?

Any ideas ?

thanks.

Andy
ahm@exel.co.uk

--
[ Szabo Zoltan ]
[ software fejleszto ]
[ econet.hu Informatikai Rt. ]
[ 1117 Budapest, Hauszmann A. u. 3. ]
[ tel.: 371 2100 fax: 371 2101 ]