Re: cannot use column references in default expression?

Поиск
Список
Период
Сортировка
От Nilesh Govindarajan
Тема Re: cannot use column references in default expression?
Дата
Msg-id AANLkTil8Dtj9h8Sys0ZuK3HRgkj-DbqcraI2-Mkh7U_o@mail.gmail.com
обсуждение исходный текст
Ответ на cannot use column references in default expression?  (Jignesh Shah <jignesh.shah1980@gmail.com>)
Список pgsql-general
On Fri, May 28, 2010 at 10:50 PM, Jignesh Shah
<jignesh.shah1980@gmail.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: cannot use column references in default expression?
Следующее
От: erobles
Дата:
Сообщение: there is a way to deactivate type validation on 8.3.1????