Re: cannot use column references in default expression?
| От | Christophe Pettus |
|---|---|
| Тема | Re: cannot use column references in default expression? |
| Дата | |
| Msg-id | 9ECED4D8-B1B4-43F9-A848-1E3DD74A8160@thebuild.com обсуждение исходный текст |
| Ответ на | Re: cannot use column references in default expression? (Jignesh Shah <jignesh.shah1980@gmail.com>) |
| Список | pgsql-general |
On May 28, 2010, at 10:41 AM, Jignesh Shah wrote:
> Trigger should be the last solution. This used to be working but I
> think with latest postgresql upgrade, this stopped working. Might be
> someone around here knows whats going on here.
I'm afraid not. It's never been allowed to have a variable in the
expression for a DEFAULT value. To quote the manual:
> DEFAULT default_expr
> The DEFAULT clause assigns a default data value for the column whose
> column definition it appears within. The value is any variable-free
> expression (subqueries and cross-references to other columns in the
> current table are not allowed). The data type of the default
> expression must match the data type of the column.
>
A trigger is the appropriate solution in this case.
--
-- Christophe Pettus
xof@thebuild.com
В списке pgsql-general по дате отправления: