Re: [HACKERS] Niladic functions

From: "D'Arcy" "J(dot)M(dot)" Cain <darcy(at)druid(dot)net>
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas G(dot) Lockhart)
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Niladic functions
Date: 1999-03-09 15:42:50
Message-ID: m10KOeg-0000buC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thus spake Thomas G. Lockhart
> > The "Integrated Document" on the web page has the following paragraph
> > in the section "CREATE TABLE" in chapter 20.
> > In the current release (v6.4), Postgres evaluates all default
> > expressions at the time the table is defined. Hence, functions which
> > are "non-cacheable" such as CURRENT_TIMESTAMP may not produce the
> > desired effect. For the particular case of date/time types, one can
> > work around this behavior by using "DEFAULT TEXT 'now'" instead of
> > "DEFAULT 'now'" or "DEFAULT CURRENT_TIMESTAMP". This forces Postgres
> > to consider the constant a string type and then to convert the value
> > to timestamp at runtime.
> >
> > This appears to be untrue. Is this a change since 6.4 or is there
> > some cases where using CURRENT_TIMESTAMP will not do the expected
> > thing?
>
> Sorry for being slow, but exactly which of the several assertions in the
> above paragraph are not true? Just the DEFAULT CURRENT_TIMESTAMP
> behavior?

Yes. This paragraph says that CURRENT_TIMESTAMP is evaluated at the time
the table is defined yet I tested this with a current version and it
actually gets evaluated at INSERT time.

> > Also, the title of the document (The PostgreSQL Development Team)
> > seems to be incorrect.
>
> My browser shows that as the second line, just under the title
> "PostgreSQL", as I intended. What browser are you using?

Sorry, my misunderstanding. I didn't realize that PostgreSQL was the
title of this particular document. Anyway, the link to this page is
"Integrated Document" so there is a small inconsistency.

--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 424 2871 (DoD#0082) (eNTP) | what's for dinner.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Broytmann 1999-03-09 15:47:24 Re: [HACKERS] Bug on complex join
Previous Message Mikhail Terekhov 1999-03-09 15:30:08 vacuum analyze