Обсуждение: Internal time stamps?
Does postgresql have any kind of internal time stamps for a table entry? I can create a field that is 'timestamp' and store it there, I was just wondering if it was already done internally. I'd hate to duplicate something it already does. :-)
If it does store it internally, how do you access it?
Thanks!!
Aaron
2009/11/24 <niccguard-dev@yahoo.com>:
> Does postgresql have any kind of internal time stamps for a table entry? I
> can create a field that is 'timestamp' and store it there, I was just
> wondering if it was already done internally. I'd hate to duplicate
> something it already does. :-)
> If it does store it internally, how do you access it?
> Thanks!!
> Aaron
KarooDB=> create table test ( ts timestamp with time zone default
now(), val text );
CREATE TABLE
KarooDB=> insert into test(val)values('123');
INSERT 0 1
KarooDB=> insert into test(val)values('456');
INSERT 0 1
KarooDB=> insert into test(val)values('abc');
INSERT 0 1
KarooDB=> insert into test(val)values('def');
INSERT 0 1
KarooDB=> select * from test;
ts | val
-------------------------------+-----
2009-11-24 21:11:44.969748+02 | 123
2009-11-24 21:11:49.913951+02 | 456
2009-11-24 21:11:54.441703+02 | abc
2009-11-24 21:11:57.529687+02 | def
(4 rows)
KarooDB=>
--
Brian Modra Land line: +27 23 5411 462
Mobile: +27 79 69 77 082
5 Jan Louw Str, Prince Albert, 6930
Postal: P.O. Box 2, Prince Albert 6930
South Africa
http://www.zwartberg.com/
niccguard-dev@yahoo.com writes:
> Does postgresql have any kind of internal time stamps for a table entry?
Nope.
The xmin column can give you some idea of when a row was created
relative to other rows, but it's definitely not a timestamp.
regards, tom lane