Обсуждение: timestamp precision with or without timezones

Поиск
Список
Период
Сортировка

timestamp precision with or without timezones

От
mboes@tweag.net
Дата:
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

От
Stephan Szabo
Дата:
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

От
Tom Lane
Дата:
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