Re: [BUGS] 'Default' troubles again. This time with time :))) - Mailing list pgsql-bugs

From Leon
Subject Re: [BUGS] 'Default' troubles again. This time with time :)))
Date
Msg-id 379200EB.B020F210@udmnet.ru
Whole thread Raw
In response to Re: [BUGS] 'Default' troubles again. This time with time :)))  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] 'Default' troubles again. This time with time :)))
List pgsql-bugs
Tom Lane wrote:

>
> > [ default value doesn't change over time ]
>
> This oughta be in the FAQ I think ...
>
> When you write a simple constant default, it gets coerced to the target
> data type before the default information is stored.  So, what you
> effectively did was to create table dd with a default value for gg
> of the time at which you executed 'create table'.
>

Tom! I tested your method of creating table with
create table ww (aa int4, bb timestamp default text 'now'),
and it didn't work either! (BTW, this is exactly the way docs suggest
doing it.)  See? I promised to deliver a real bug and I did it! :)))


Yes, docs mumble something about 'cacheable' and 'non-cacheable'
functions, but it is not clear to me how Postgres discerns them.

It is complete puzzle to me why 'USER' is cacheable and 'CURRENT_TIMESTAMP'
is not. This distinction, I think, should be made clearer. Maybe in
the sensible form of two-column table in the docs. :) One column is
function name, the other is 'cacheability'.

--
Leon.


pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] 'Default' troubles again. This time with time :)))
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] 'Default' troubles again. This time with time :)))