Default values?

Started by Nonameabout 25 years ago2 messagesgeneral
Jump to latest
#1Noname
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

#2Richard Huxton
dev@archonet.com
In reply to: Noname (#1)
Re: Default values?

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