Re: Adding PK to Existing Table

Поиск
Список
Период
Сортировка
От Raghavendra
Тема Re: Adding PK to Existing Table
Дата
Msg-id AANLkTi=GfGQpA3bp=T0jehuSC7TEp5pVrOtUK+QxY1jN@mail.gmail.com
обсуждение исходный текст
Ответ на Adding PK to Existing Table  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Adding PK to Existing Table [RESOLVED]  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general
Try out this...

 alter table <table name> add primary key(column name);

Best Regards,
Raghavendra
EnterpriseDB Corporation


On Fri, Apr 1, 2011 at 9:09 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:
 In -9.0.3 I used ALTER TABLE to replace a varchar() column with a bigint
column so it can be assigned as the table's primary key. From the 9.0.3
manual I tried various flavors of ALTER TABLE <tablename> ADD CONSTRAINT but
cannot find the proper syntax to create the PK. Do I need to first make the
column UNIQUE, then add a NOT NULL constraint?

Rich

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

В списке pgsql-general по дате отправления:

Предыдущее
От: Rich Shepard
Дата:
Сообщение: Adding PK to Existing Table
Следующее
От: Raghavendra
Дата:
Сообщение: Re: How to get index columns/dir/ord informations?