insert statement in postgres for data type timestamp without time zone NOT NULL, insert statement in postgres for data type timestamp without time zone NOT NULL, postgresql postgresql

insert statement in postgres for data type timestamp without time zone NOT NULL,


Use now() or CURRENT_TIMESTAMP.


In addition to C. Ramseyer's solution (which is right), if you always (or even usually) want make_date to be the date the record was created, you can set its default to now():

alter table inventory_tbl alter make_date set default now();

Then if you don't include it in the list of columns in your insert, it'll be automatically set to now():

test=> insert into inventory_tbl ( name ) values ('brick'), ('sand'), ('obsidian') returning *;         make_date          |   name   ----------------------------+---------- 2013-03-21 09:10:59.897666 | brick 2013-03-21 09:10:59.897666 | sand 2013-03-21 09:10:59.897666 | obsidian(3 rows)INSERT 0 3