On 15 Apr 2003 10:58:48 +0200, Rado Petrik wrote
> Hi ,
>
> I have column type "timestamptz".
> I need automatic add date and time when create new row.
>
> example.
>
> id | name | dt_created
> ---------------------
>
> INSERT INTO table (name) VALUES('test')
>
> id | name | dt_created
> -------------------------------
> 1 test 1980-06-25 11:11-7
Use now() when defining your table.
It would be something like this:
create table some_table(
...
dt_created timestamptz default now()
);
Remember, that now() is a transaction time, so inside one transaction all
rows would have the same time.
Regards,
Tomasz Myrta