| From: | Nilesh Govindarajan <lists(at)itech7(dot)com> |
|---|---|
| To: | Jignesh Shah <jignesh(dot)shah1980(at)gmail(dot)com> |
| Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: cannot use column references in default expression? |
| Date: | 2010-05-28 17:27:55 |
| Message-ID: | AANLkTil8Dtj9h8Sys0ZuK3HRgkj-DbqcraI2-Mkh7U_o@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Fri, May 28, 2010 at 10:50 PM, Jignesh Shah
<jignesh(dot)shah1980(at)gmail(dot)com> wrote:
> Could anyone please help me to get rid of following error? I want to set the
> 'ishuman' column based on the value of 'ID' column but it is not allowing me
> to do so. Any alternatives?
>
> techdb=> CREATE TABLE Users (
> ID INTEGER,
> isHuman BOOLEAN NOT NULL
> DEFAULT (ID IS NULL)
> CHECK (isHuman = ID IS NULL),
> Name VARCHAR NOT NULL);
> ERROR: cannot use column references in default expression
> techdb=>
>
> Thanks,
> Jignesh
>
I don't know much about the error, but an alternative solution I see
is using Triggers. WIth triggers you can manipulate the value during
INSERT or UPDATE.
--
Nilesh Govindarajan
Facebook: nilesh.gr
Twitter: nileshgr
Website: www.itech7.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Craig Ringer | 2010-05-28 17:30:59 | Re: cannot use column references in default expression? |
| Previous Message | Craig Ringer | 2010-05-28 17:27:39 | Re: INSERTing lots of data |