Re: Primary key on existing table?
От | Ries van Twisk |
---|---|
Тема | Re: Primary key on existing table? |
Дата | |
Msg-id | 00C3AE55-C76E-4D27-BE84-DA3133ADC450@rvt.dds.nl обсуждение исходный текст |
Ответ на | Primary key on existing table? (Carol Walter <walterc@indiana.edu>) |
Список | pgsql-admin |
On Aug 25, 2009, at 3:25 PM, Carol Walter wrote:
This may be a silly question but I don't see any place where the documentation explicitly addresses whether or not you can designate a particular column as a primary key after the table is created. I used the "create table as " syntax to create a table with the same columns as an original table, but I want to rename id column, make it a serial, and designate it as a primary key. Is it possible to do this? I've tried a number of things to do this and none of them have worked.
See this document: http://www.postgresql.org/docs/8.3/static/sql-altertable.html
for example: ALTER TABLE distributors ADD PRIMARY KEY (dist_id);
Also checkout pgAdmin III....
Ries
Carol
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
regards, Ries van Twisk
-------------------------------------------------------------------------------------------------
tags: Freelance TYPO3 Glassfish JasperReports JasperETL Flex Blaze-DS WebORB PostgreSQL DB-Architect
email: ries@vantwisk.nl web: http://www.rvantwisk.nl/ skype: callto://r.vantwisk
Phone: +1-810-476-4196 Cell: +593 9901 7694 SIP: +1-747-690-5133
В списке pgsql-admin по дате отправления: