pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedatomatic insert date and time
2+ messages / 2 participants
[nested] [flat]
* atomatic insert date and time
@ 2003-04-15 08:58 Rado Petrik <r.p@szm.sk>
2003-04-15 09:50 ` Re: atomatic insert date and time jasiek <jasiek@klaster.net>
0 siblings, 1 reply; 2+ messages in thread
From: Rado Petrik @ 2003-04-15 08:58 UTC (permalink / raw)
To: pgsql-sql
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
thanks. Rado.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: atomatic insert date and time
2003-04-15 08:58 atomatic insert date and time Rado Petrik <r.p@szm.sk>
@ 2003-04-15 09:50 ` jasiek <jasiek@klaster.net>
0 siblings, 0 replies; 2+ messages in thread
From: jasiek @ 2003-04-15 09:50 UTC (permalink / raw)
To: Rado Petrik <r.p@szm.sk>; pgsql-sql
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-04-15 09:50 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-04-15 08:58 atomatic insert date and time Rado Petrik <r.p@szm.sk>
2003-04-15 09:50 ` jasiek <jasiek@klaster.net>
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