Re: How to enforce the use of the sequence for serial columns

Поиск
Список
Период
Сортировка
От Marc Mamin
Тема Re: How to enforce the use of the sequence for serial columns
Дата
Msg-id CA896D7906BF224F8A6D74A1B7E54AB3198766@JENMAIL01.ad.intershop.net
обсуждение исходный текст
Список pgsql-admin
> It's not a full solution anyway since it prevents any kind of update
on the table due to check constraints firing  even if target field not
updated.  >

Well, we can extend the check within the trigger:

if (coalesce old.a=new.a -- Update
    OR
    new.a = currval(tg_argv[0] -- Insert
) then
  return new;
end if;

Marc



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

Предыдущее
От: Jerry Sievers
Дата:
Сообщение: Re: How to enforce the use of the sequence for serial columns
Следующее
От: "Ben K."
Дата:
Сообщение: Re: How to enforce the use of the sequence for serial columns