# Last Updated Columns With Postgres

DevFeed: [Last Updated Columns With Postgres](<https://devfeed.tech/articles/last-updated-columns-with-postgres-18846.md>)

Original publisher: [Read original article](<https://www.morling.dev/blog/last-updated-columns-with-postgres/>)

Published: 2024-02-20T08:15:00Z

Content type: tutorial

Language: en

Sources: [Gunnar Morling](<https://devfeed.tech/sources/gunnar-morling.md>)

Topics: [Databases](<https://devfeed.tech/topics/databases.md>), [MySQL](<https://devfeed.tech/topics/mysql.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [database](<https://devfeed.tech/tags/database.md>), [mysql](<https://devfeed.tech/tags/mysql.md>), [postgres](<https://devfeed.tech/tags/postgres.md>)

## AI overview

The article explains how to maintain created and updated timestamps in PostgreSQL. It presents explicitly setting a field to its database default during updates as a simpler alternative to defining triggers for every table, while noting that each update statement must set the field.

## Source excerpt

In many applications it's a requirement to keep track of when a record was created and updated the last time. Often, this is implemented by having columns such as created_at and updated_at within each table. To make things as simple as possible for application developers, the database itself should take care of maintaining these values automatically when a record gets inserted or updated.