Add create and update timestamp to all objects

Started by Efrain J. Berdeciaover 4 years ago4 messages
#1Efrain J. Berdecia
ejberdecia@yahoo.com

Are there any plans to add a create and last updated time stamp field to any and all objects in postgres?
Possibly even adding a updated_by documenting which role created and last updated the object.
All done natively and without the need for extra extensions.
Thanks in advance.

#2Nikolay Samokhvalov
samokhvalov@gmail.com
In reply to: Efrain J. Berdecia (#1)
Re: Add create and update timestamp to all objects

On Sun, Sep 26, 2021 at 1:11 PM Efrain J. Berdecia <ejberdecia@yahoo.com>
wrote:

Are there any plans to add a create and last updated time stamp field to
any and all objects in postgres?

Possibly even adding a updated_by documenting which role created and last
updated the object.

All done natively and without the need for extra extensions.

Thanks in advance.

Why would you need that? Each timestamp[tz] value is 8 bytes.

And setting up values via defaults and triggers is straightforward, isn't
it?

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Efrain J. Berdecia (#1)
Re: Add create and update timestamp to all objects

"Efrain J. Berdecia" <ejberdecia@yahoo.com> writes:

Are there any plans to add a create and last updated time stamp field to any and all objects in postgres?

No. This has been proposed and rejected (more than once).

regards, tom lane

#4Chapman Flack
chap@anastigmatix.net
In reply to: Tom Lane (#3)
Re: Add create and update timestamp to all objects

On 09/26/21 18:28, Tom Lane wrote:

"Efrain J. Berdecia" <ejberdecia@yahoo.com> writes:

Are there any plans to add a create and last updated time stamp field to any and all objects in postgres?

No.

That said, if you'd be satisfied with a create OR last updated time,
there should already be a txid there.

If you have track_commit_timestamp turned on, there's your time.

If it's not turned on, but you want to know the time, there are ways.[0]https://stackoverflow.com/a/61788447/4062350

Regards,
-Chap

[0]: https://stackoverflow.com/a/61788447/4062350