Re: how to create secondary key!!

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: how to create secondary key!!
Дата
Msg-id web-1798058@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на how to create secondary key!!  ("Nelson Yong" <nelsonyong@ipmuda.com.my>)
Список pgsql-novice
Nelson,

> If i migrate the database from Text file using pgadmin tools,the
> table
> and data record will be created automatically and no primary key
> assign
> so now i need to assign the key but unfortunely i can't change the
> field
> property. i.e. I can't assign "two-column primary key."

You'll need to use the command line for this.  Open an ad-hoc query
window from PGAdminII (the wierd-looking monster).   Run the following
command:

ALTER TABLE table_name ADD CONSTRAINT table_name_PK
PRIMARY KEY (column_1, column_2);

... where you replace table_name, column_1 and column_2 with the
appropriate objects from your database.

BTW, the above command will fail if it turns out that the combination
of column_1 and column_2 is not unique, or if either column has NULLs.

-Josh Berkus


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

Предыдущее
От: "Simon Kelly"
Дата:
Сообщение: oidin error when parsing XML documents
Следующее
От: "Josh Berkus"
Дата:
Сообщение: Re: Postgres and Sybase