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

Поиск
Список
Период
Сортировка
Искать

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

От:
"Marc Mamin" <M.Mamin@intershop.de>
Дата:

> 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


FAQ