Re: Changing column constraints?

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Changing column constraints?
Дата
Msg-id web-699705@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на Changing column constraints?  (Henry Holland <spoedniek@gmx.net>)
Ответы Re: Changing column constraints?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-sql
Henry,

> If I have a column constraint:
>     addr_type char( 10 ) default 'street'
>     CHECK( addr_type = 'street' || addr_type = 'pobox' ),
> in a table, how can I add another choice to the list after I've
>  already
> entered data into the table?

Three options:

One, drop and rebuild the table with the constraint modified.  Sorry,but until we have ALTER CONSTRAINT implemented,
thisis the onlysimple way to modify and exisiting constraint.
 

Two, mess with system tables to alter the constraint.  I do notreccomend this.

Three, drop and re-build the table, and this time do it right: havecolumn addr_type reference another table called
"addr_types"that listthe acceptable type values.  Then use a foriegn key to enforce this.
 

-Josh Berkus


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

Предыдущее
От: david blood
Дата:
Сообщение: current connections and queries
Следующее
От: "Marshall Spight"
Дата:
Сообщение: Re: UNION and rows improperly unified: query optimization question