Search Postgresql Archives

Re: Column Default Clause and User Defined Functions

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

 



Michael Glaesemann <grzm@xxxxxxxxxxxxxxx> writes:
> On Jun 27, 2007, at 18:18 , Keary Suska wrote:
>> Is it possible to have a user-defined function (a plpqsql function)  
>> as the
>> argument to a default clause that issues SELECTs on other tables?

> Not according to the documentation:
> http://www.postgresql.org/docs/8.2/interactive/sql-createtable.html

What those docs say is that you can't have a naked sub-SELECT in the
DEFAULT expression.  This is to some extent an implementation limitation
--- we don't do planning on DEFAULT expressions.  You can definitely get
around it by hiding the sub-SELECT in a function.

Whether that is a good idea is another question entirely ... it seems
a bit questionable, but on the other hand time-varying defaults like
"default now()" have time-honored usefulness, so I'm not quite sure
why I feel uncomfortable with it.

			regards, tom lane


[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