time_stamp type

Lists: pgsql-hackers
From: "Stephen R(dot) van den Berg" <srb(at)cuci(dot)nl>
To: pgsql-hackers(at)postgresql(dot)org
Subject: time_stamp type
Date: 2008-07-05 16:34:54
Message-ID: 20080705163454.GB26034@cuci.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

What's the deal with this type? Is it used internally?
It's the only type that seems to have anything meaningfull in
typdefaultbin and typdefault columns in pg_type.
--
Sincerely,
Stephen R. van den Berg.

WARNING: Do not look into laser with remaining eye


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Stephen R(dot) van den Berg" <srb(at)cuci(dot)nl>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: time_stamp type
Date: 2008-07-06 05:19:19
Message-ID: 23532.1215321559@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Stephen R. van den Berg" <srb(at)cuci(dot)nl> writes:
> What's the deal with this type?

It's a domain over timestamptz, as required by the SQL spec definition
of the information_schema.

postgres=# \dD information_schema.time_stamp
List of domains
Schema | Name | Type | Modifier | Check
--------------------+------------+-----------------------------+----------------------------------------------------+-------
information_schema | time_stamp | timestamp(2) with time zone | default ('now'::text)::timestamp(2) with time zone |
(1 row)

[ re-reads spec... ] Hm, actually the spec is self-contradictory here:
SQL99 20.7 saith

CREATE DOMAIN TIME_STAMP AS TIMESTAMP (2)
DEFAULT CURRENT_TIMESTAMP(2);

which appears to imply that TIME_STAMP is a domain over timestamp
*without* time zone ... but that is contradicted by the specification
that the default is CURRENT_TIMESTAMP, which yields a value *with*
time zone. (LOCALTIMESTAMP is the function that should have been
mentioned if they really meant without time zone.)

[ pokes further... ] Hmm, last year's SQL200n draft saith

CREATE DOMAIN TIME_STAMP AS TIMESTAMP(2) WITH TIME ZONE;

with no mention of a default. I do wish these people could make
up their minds.

regards, tom lane