在Postgresql表中默认插入当前时间

CREATE  SEQUENCE serial
  INCREMENT 
1
  MINVALUE 
1
  MAXVALUE 
9223372036854775807
  START 
12
  CACHE 
1 ;
ALTER   TABLE  serial OWNER  TO  postgres;

CREATE   TABLE  t_sms_send_history(
  id 
integer   PRIMARY   KEY   DEFAULT  nextval( ' serial ' ),
  sm_id 
integer ,
  src_id 
varchar ( 10 ),
  mobiles 
varchar ( 8000 ),
  contents 
varchar ( 2000 ),
  
datetime   varchar ( 40 DEFAULT  (now())

WITHOUT OIDS;
ALTER   TABLE  t_user_info OWNER  TO  postgres;

insert   into  t_sms_send_history (sm_id,src_id,mobiles,contents)  values ( 1 , ' 1 ' , ' 13900000000 ' , ' testmessage ' );

 不可以使用 date(now)+time(now) 这样时间只是建表时间。

你可能感兴趣的:(在Postgresql表中默认插入当前时间)