Thread: timestamp precision with or without timezones

timestamp precision with or without timezones

From
mboes@tweag.net
Date:
Hi there,

Is there a way of specifying the precision of a timestamp *with
timezone* field? It works fine for timestamps *without* timezones, but
gives me a syntax error if I try with timestamptz:

tweag=> create table tbl1 (t timestamp(0));
CREATE TABLE
tweag=> \d tbl1
                 Table "public.tbl1"
 Column |              Type              | Modifiers
--------+--------------------------------+-----------
 t      | timestamp(3) without time zone |

tweag=> create table tbl1 (t timestamptz(0));
ERROR:  syntax error at or near "(" at character 33
tweag=> create table tbl1 (t timestamp(0) without timezone);
ERROR:  syntax error at or near "timezone" at character 43

TIA,

Mathieu Boespflug

Re: timestamp precision with or without timezones

From
Stephan Szabo
Date:
On Wed, 7 Apr 2004 mboes@tweag.net wrote:

> Hi there,
>
> Is there a way of specifying the precision of a timestamp *with
> timezone* field? It works fine for timestamps *without* timezones, but

I think you can with the
timestamp(m) with time zone

(note the space between time and zone)

Re: timestamp precision with or without timezones

From
Tom Lane
Date:
mboes@tweag.net writes:
> Is there a way of specifying the precision of a timestamp *with
> timezone* field? It works fine for timestamps *without* timezone

It's
    timestamp(n) with time zone
    timestamp(n) without time zone
and not any other variants that might seem natural.

Don't blame us, that's what the SQL standard says ;-)

            regards, tom lane