Re: [GENERAL] default value based on select

2008-04-05 Thread Volkan YAZICI
On Sat, 5 Apr 2008, Pedro Doria Meunier <[EMAIL PROTECTED]> writes: > The record being created has a column with an Id that has to be passed as an > argument to the function that, in turn, fills the other column in the same > record. Doesn't BEFORE INSERT/UPDATE trigger solve this problem? (If n

Re: [GENERAL] default value based on select

2008-04-05 Thread Pedro Doria Meunier
Pavel and Volkan Thank you for your kind (and prompt) replies. Let me try to better explain my needs: The record being created has a column with an Id that has to be passed as an argument to the function that, in turn, fills the other column in the same record. Does this even make sense? :) K

Re: [GENERAL] default value based on select

2008-04-05 Thread Volkan YAZICI
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 thi

Re: [GENERAL] default value based on select

2008-04-05 Thread Pavel Stehule
Hello On 05/04/2008, Pedro Doria Meunier <[EMAIL PROTECTED]> wrote: > Hi, > > Is it possible to have a table's column default value set to some form of > select? > directly no, but you can use function postgres=# create table a(a integer); CREATE TABLE postgres=# create function mx() returns

[GENERAL] default value based on select

2008-04-05 Thread Pedro Doria Meunier
Hi, Is it possible to have a table's column default value set to some form of select? e.g. picking another table's value for a given SELECT ... WHERE ... Already thankful for any insight, -- Pedro Doria Meunier Ips. da Olaria, Edf. Jardins do Garajau, 4, r/c Y 9125-162 Caniço Madeira - Portuga