Search Postgresql Archives

Re: cannot use column references in default expression?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 28, 2010 at 10:50 PM, Jignesh Shah
<jignesh.shah1980@xxxxxxxxx> 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux