Re: Default values?

From: "Richard Huxton" <dev(at)archonet(dot)com>
To: <pgsql-general(at)postgresql(dot)org>, "Bruce Richardson" <brichard(at)cafod(dot)org(dot)uk>
Subject: Re: Default values?
Date: 2001-02-19 09:25:20
Message-ID: 00cd01c09a55$e27cc7e0$1001a8c0@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: "Bruce Richardson" <brichard(at)cafod(dot)org(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2001-02-19 09:29:26 Re: not using table aliases in where clause slow-down?
Previous Message Karel Zak 2001-02-19 08:27:31 Re: .TO_CHAR problem