Обсуждение: Default values?

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

Default values?

От
brichard@cafod.org.uk (Bruce Richardson)
Дата:
If I wanted to create a table in such a way that the default value of
one column is the value of another column (or the oid value), is there
a way to do that in the CREATE TABLE statement (with the DEFAULT
keyword, I'd imagine)?  Or would I need to create a trigger?

--
Bruce

Re: Default values?

От
"Richard Huxton"
Дата:
From: "Bruce Richardson" <brichard@cafod.org.uk>


> If I wanted to create a table in such a way that the default value of
> one column is the value of another column (or the oid value), is there
> a way to do that in the CREATE TABLE statement (with the DEFAULT
> keyword, I'd imagine)?  Or would I need to create a trigger?
>
> --
> Bruce

Trigger AFAIK. I've used functions in DEFAULTs but get errors with
references to another column. I presume it's because the system can't tell
whether your mean OLD.col or NEW.col

- Richard Huxton