Re: Default values? - Mailing list pgsql-general

From Richard Huxton
Subject Re: Default values?
Date
Msg-id 00cd01c09a55$e27cc7e0$1001a8c0@archonet.com
Whole thread Raw
In response to Default values?  (brichard@cafod.org.uk (Bruce Richardson))
List pgsql-general
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


pgsql-general by date:

Previous
From: Karel Zak
Date:
Subject: Re: .TO_CHAR problem
Next
From: "Richard Huxton"
Date:
Subject: Re: not using table aliases in where clause slow-down?