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@xxxxxxxxxxxx
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general