Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mpsyR-0005cO-0B for pgsql-general@arkaria.postgresql.org; Wed, 24 Nov 2021 14:10:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mpsyP-0007rO-FX for pgsql-general@arkaria.postgresql.org; Wed, 24 Nov 2021 14:10:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mpsyP-0007rF-3M for pgsql-general@lists.postgresql.org; Wed, 24 Nov 2021 14:10:09 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mpsyG-0007yD-HH for pgsql-general@lists.postgresql.org; Wed, 24 Nov 2021 14:10:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=KPZAvrThHi6jG/MhDCM1uttzW4BGYRcC+z+y04NCS6k=; b=ZULRbpYKV2nBQWKIVBuvDdlCda X3tjrzMfjm2sqsx0CzIjZpWE63oaWRfd6CzEW5ck4lTubxpFAoVUYW1fk2VpY1ce106V/nTzM3Pt5 487Ym1SLnsst0M0QpPC2YbZl6SJ9A8p0f3onK1wl7E6svElPHf6uB+rQhlUj9DZuKvjs=; Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by depesz.com with esmtpa (Exim 4.92) (envelope-from ) id 1mpsyE-0006Ap-RP; Wed, 24 Nov 2021 15:09:58 +0100 Date: Wed, 24 Nov 2021 15:09:58 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Luca Ferrari Cc: pgsql-general Subject: Re: get last timestamp of table ddl Message-ID: <20211124140958.GA20928@depesz.com> Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Nov 24, 2021 at 02:53:24PM +0100, Luca Ferrari wrote: > Hi all, > I think I already know the answer, however I came across this table in > Oracle > that has two columns that triggered my attention: CREATED and > LAST_DDL_TIME. > Apart from being dates (in the Oracle way), they store the time of > creation and last modification to the table structure. > I don't have any particular use case except from blaming someone about > a change in the database structure, however I'm curious: is there a > smarter way to achieve this in PostgreSQL than simply relying on logs > and commit timestamps? You could add event triggers to achieve similar functionality. https://www.depesz.com/2012/07/29/waiting-for-9-3-event-triggers/ and https://www.postgresql.org/docs/current/sql-createeventtrigger.html depesz