Re: check

Поиск
Список
Период
Сортировка
От Manfred Koizar
Тема Re: check
Дата
Msg-id gf3sgu486fbgrvb0tc5hpqp7dl0shqvdkh@4ax.com
обсуждение исходный текст
Ответ на check  (Matt <matthew.berardi@weilpublishing.com>)
Список pgsql-sql
On Fri, 14 Jun 2002 14:47:32 -0400, Matt
<matthew.berardi@weilpublishing.com> wrote:
>how would you go about enforcing the default value:
>
>I have a nextval('seq') as my default and on an insert I don't want any 
>other value to be allowed.

Matt,
   CREATE TABLE tab (id INTEGER NOT NULL DEFAULT 0, ...

and add a before insert trigger that *unconditionally* puts
nextval('seq') into new.id.  I guess, you don't want to allow your
users to change the id of an existing row, so you might also want to
add a before update trigger that sets new.id to old.id.

ServusManfred


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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: check
Следующее
От: Jeff Boes
Дата:
Сообщение: Re: Limiting database size