current_timestamp without TZ in CREATE table

Started by Jean-Christian Imbeaultover 23 years ago3 messagesgeneral
Jump to latest
#1Jean-Christian Imbeault
jc@mega-bucks.co.jp

I get the following error while trying to create a table:

JC=# create table test (t timestamp[0] default current_timestamp(0));
ERROR: Column "t" is of type timestamp without time zone[] but default
expression is of type timestamp with time zone You will need to rewrite
or cast the expression

What is the proper syntax to declare the default to be without time zone?

Thanks,

JC

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jean-Christian Imbeault (#1)
Re: current_timestamp without TZ in CREATE table

Jean-Christian Imbeault <jc@mega-bucks.co.jp> writes:

I get the following error while trying to create a table:
JC=# create table test (t timestamp[0] default current_timestamp(0));
ERROR: Column "t" is of type timestamp without time zone[] but default
expression is of type timestamp with time zone You will need to rewrite
or cast the expression

Square brackets mean an array. I think you meant timestamp(0).

regards, tom lane

#3Jean-Christian Imbeault
jc@mega-bucks.co.jp
In reply to: Jean-Christian Imbeault (#1)
Re: current_timestamp without TZ in CREATE table

Tom Lane wrote:

Square brackets mean an array. I think you meant timestamp(0).

Doh. Silly manual has the syntax for timestamps as timestamp [ (p) ] and
I though the square brackets meant "optional (p)" ... oops.

Jc