Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tcXVr-000p3L-6W for pgsql-general@arkaria.postgresql.org; Mon, 27 Jan 2025 22:23:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tcXVq-00FByq-8p for pgsql-general@arkaria.postgresql.org; Mon, 27 Jan 2025 22:23:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tcXVp-00FByh-Uw for pgsql-general@lists.postgresql.org; Mon, 27 Jan 2025 22:23:21 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tcXVn-001rAk-03 for pgsql-general@lists.postgresql.org; Mon, 27 Jan 2025 22:23:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 50RMN7go739282; Mon, 27 Jan 2025 17:23:07 -0500 From: Tom Lane To: "Peter J. Holzer" cc: Nem Tudom , pgsql-general@lists.postgresql.org Subject: Re: Issues with EPOCH-s, TIMESTAMP(TZ)-s and leap seconds. In-reply-to: <20250127211657.b7gbkfgyjpvdokes@hjp.at> References: <20250127211657.b7gbkfgyjpvdokes@hjp.at> Comments: In-reply-to "Peter J. Holzer" message dated "Mon, 27 Jan 2025 22:16:57 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <739280.1738016587.1@sss.pgh.pa.us> Date: Mon, 27 Jan 2025 17:23:07 -0500 Message-ID: <739281.1738016587@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Peter J. Holzer" writes: > On 2025-01-27 21:01:59 +0000, Nem Tudom wrote: >> I thought that the EPOCH was the number of seconds since 1970-01-01 >> 00:00:00? Is this incorrect? > The POSIX standard mandates that leap seconds must be ignored. It's not > really "number of seconds since 1970-01-01", but "number of days since > 1970-01-01 times 86400 plus number of seconds in the current day". I'm not sure what POSIX says about this, but that is the definition Postgres uses --- and we won't let you select a timezone setting that does account for leap seconds. postgres=# set timezone = 'America/New_York'; SET postgres=# set timezone = 'right/America/New_York'; ERROR: time zone "right/America/New_York" appears to use leap seconds DETAIL: PostgreSQL does not support leap seconds. If we did support that, it'd enormously complicate all timestamp arithmetic --- and we could hardly do calculations with times in the future at all, given the uncertainty around when leap seconds will be declared. So if you want to do astronomical timekeeping, you should use some other data type than timestamptz. regards, tom lane