Primary Key

From: "P(dot) Dwayne Miller" <dmiller(at)espgroup(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Primary Key
Date: 2001-06-19 18:26:56
Message-ID: 3B2F9970.25F328AE@espgroup.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Given the following CREATE TABLE instructions...

1)
CREATE TABLE message
(
int4 msgid PRIMARY KEY NOT NULL,
text msgtext
);

2)
CREATE TABLE message
(
int4 msgid not null,
text msgtext,
PRIMARY KEY (msgid)
);

3)
CREATE TABLE message
(
int4 msgid not null,
text msgtext,
CONSTRAINT cons_001_pk PRIMARY KEY on (msgid)
);

The first two actually create a PRIMARY KEY on msgid. The third seems
to have a PRIMARY KEY on 'oid', not 'msgid', though it does create a
unique index on 'msgid'. One of the applications I'm using (Cold
Fusion) looks for the PRIMARY KEY and checks that I have included that
column(s) in my data statement.

The first two work, the third does not. Cold Fusion reports that I did
not provide 'oid' as one of the data elements.

Cold Fusion is accessing the database using ODBC.
Database is Postgres v7.1.1 on Red Hat Linux 7.0

I'm not looking for a fix as I can create the table using the syntax
that gives the expected results, but just wanted to alert someone that
there is some inconsistency in the way a PRIMARY KEY is used or
designated.

BTW, I did not try the COLUMN CONSTRAINT syntax.

Thanks

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-06-19 18:41:12 Re: Problem with reading startup packet after fork
Previous Message Joe Conway 2001-06-19 16:07:07 Re: AW: Re: [SQL] behavior of ' = NULL' vs. MySQL vs. Stand ards