Обсуждение: PRIMARY KEY

Поиск
Список
Период
Сортировка

PRIMARY KEY

От
Leitor de Listas
Дата:
Hi people,

Does anybody happen to know how I can alter a user table to include the
primary key? I'm using the beta4 version of Postgresql7.0, and I'm aware
that the primary key has already been implemented. I've tried to do ALTER
TABLE ADD CONSTRAINT PRIMARY KEY but it didn't work.

Thanks in advance,
Gabriela.



Re: PRIMARY KEY

От
Bruce Momjian
Дата:
>
> Hi people,
>
> Does anybody happen to know how I can alter a user table to include the
> primary key? I'm using the beta4 version of Postgresql7.0, and I'm aware
> that the primary key has already been implemented. I've tried to do ALTER
> TABLE ADD CONSTRAINT PRIMARY KEY but it didn't work.
>

Well, in the pre-foreign key days, an unique not null column was the
same as primary key.  Now foreign keys refer to them as special.  I
don't think ALTER TABLE supports PRIMARY KEY changes, though it should.

--
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026