Table column of type timestamp without milliseconds?

Ale*_* Yu 5 postgresql types timestamp create-table

I want to create a table have(id,time) and time (timestamp without timezone) without milliseconds.
And I also want to insert the current time per default.

CREATE TABLE ddd (
    id          serial not null,         
    time        timestamp without time zone default now()
    );
Run Code Online (Sandbox Code Playgroud)

Pav*_*ule 15

指定精度:

postgres=# CREATE TABLE foo(a timestamp(0));
CREATE TABLE
postgres=# INSERT INTO foo VALUES(CURRENT_TIMESTAMP);
INSERT 0 1
postgres=# SELECT * FROM foo;
          a          
---------------------
 2014-01-02 07:26:23
(1 row)
Run Code Online (Sandbox Code Playgroud)

小记 - "time"对于表字段来说是一个坏名字(我理解这是一个例子).任何字段名称都应具有特定的语义.