On Sat, 5 Apr 2008, Pedro Doria Meunier <[EMAIL PROTECTED]> writes: > Is it possible to have a table's column default value set to some form of > select?
AFAIK, you cannot provide sub-selects in the default values of a field. E.g. CREATE TABLE foo (bar int DEFAULTS (SELECT ...), ...); For this, I know two solutions: 1. You can create an SQL function that issues the related sub-select and call this function as the default value of the column. 2. Create a BEFORE INSERT/UPDATE trigger that issues the related sub-select if related column appears to be un-specified. Regards. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general