From: jasiek <jasiek@klaster.net>
To: Rado Petrik <r.p@szm.sk>
To: pgsql-sql@postgresql.org
Subject: Re: atomatic insert date and time
Date: Tue, 15 Apr 2003 11:50:12 +0200
Message-ID: <20030415094834.M11527@klaster.net> (raw)
In-Reply-To: <1050397128.992.41.camel@caj>
References: <1050397128.992.41.camel@caj>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jasiek@klaster.net, r.p@szm.sk
Subject: Re: atomatic insert date and time
In-Reply-To: <20030415094834.M11527@klaster.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox