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 1ma2mn-0004WI-11 for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Oct 2021 21:24:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ma2mi-0007wN-VU for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Oct 2021 21:24:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ma25J-0003DB-8O for pgsql-bugs@lists.postgresql.org; Mon, 11 Oct 2021 20:39:45 +0000 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ma25E-0005Wj-Gp for pgsql-bugs@lists.postgresql.org; Mon, 11 Oct 2021 20:39:44 +0000 Received: by mail-qt1-x830.google.com with SMTP id b12so9530323qtq.3 for ; Mon, 11 Oct 2021 13:39:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:mime-version:subject:message-id:date:to; bh=mTU/GnfyNLn77qikNgRTLALsnrUZh97c9ETdxWLu5d0=; b=j0Pg+DnYIWwlJvI8fQnKGHHxlUEc7eCPCkPm8MrX/fGi/IBBvWGZUehhyT1bnA3JrP KKpPDD0etpXiqnqv8cI5VNXwqtZdtAeAZZGbcAjEFQ32rV5bJnged6CixMe7cfLkoTVd 1TiWpV6ZYNx2Tnz3b057Wk2popkh7o29GRjbGKn0J9UDaL4j/24fUki+BpY4xYm/MpZF MSadVOrzujKvKs6DQ92OI/bSkwZhiSopE7I5mkvhOVoMv2znZn3gtrCE4p1affvrZaqw z9n/P+FVbi/Q2PkJLEVl6gpki3yZOjNrdkx2KKOlbsrgZ/6ic6uYc0oNijjnoVupbd3e VqKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=mTU/GnfyNLn77qikNgRTLALsnrUZh97c9ETdxWLu5d0=; b=m7jpV3VyHtM9wHpoJrl4Zx/V+X+DnaI7m0p4qAaLusM2TQGbmRkEwx94wMlqGFI98r KWc8V9ccxxPhSliT3L6kHBmxZm5g93zeN2N007J0+jQrohu7fVey05UI1pcXQ9gk9Adk /3LDBTyDctsw7a5v7hbnO5OhDgNHnrbWJuqqr6BC1VRVmnHf2OjAmh+5A5MGvSNuj6fK hsZxTfeHKJuiNyCkRmr+clmP2gl87bavHHbUytLCkzIu/lnRhG9midPFpe+oWZXu7A8B 8+KLNvjsQ2MZG3eoK2LTbSS/bSp9NN075k8EEmW91Bohad+sKlKLbNyNy8zw0QjKCPHC 9uAg== X-Gm-Message-State: AOAM532gNwo4WYdnErTtEHcNv6QBRyR3HJjnYw9r1CX0gUYWYL3ZyNxA biFweSzmnF8QeIVCseD9/wW7PIBTVG0= X-Google-Smtp-Source: ABdhPJzFFm4KCBX/K1sNTcIVkFVuiFkMfrPWUYGXJMDpE9TpElq3+BG1nEy1qeLj7iq8EwDyyNd0hA== X-Received: by 2002:a05:622a:11d5:: with SMTP id n21mr18085794qtk.112.1633984779133; Mon, 11 Oct 2021 13:39:39 -0700 (PDT) Received: from smtpclient.apple (pool-173-79-138-153.washdc.fios.verizon.net. [173.79.138.153]) by smtp.gmail.com with ESMTPSA id h125sm4791805qkc.29.2021.10.11.13.39.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Oct 2021 13:39:38 -0700 (PDT) From: Zhihong Zhang Content-Type: multipart/alternative; boundary="Apple-Mail=_105794D5-5293-4036-9CF6-C6EB558A12FA" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Epoch from age is incorrect Message-Id: Date: Mon, 11 Oct 2021 16:39:37 -0400 To: pgsql-bugs X-Mailer: Apple Mail (2.3654.120.0.1.13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_105794D5-5293-4036-9CF6-C6EB558A12FA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii The epoch from following statement is incorrect, test_db=3D# select extract(epoch from age(TIMESTAMP '2013-02-18 = 06:15:15')); date_part=20 ----------- 272396685 (1 row) The correct value should be test_db=3D# select (extract(epoch from now()) - extract(epoch from = TIMESTAMP '2013-02-18 06:15:15')); ?column? =20 ------------------ 272816228.311208 (1 row) They are several days apart. Maybe leap years are not counted properly? Postgresql version: PostgreSQL 11.12 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 = 20150623 (Red Hat=20 Let me know if you need more information. Thanks! Zhihong --Apple-Mail=_105794D5-5293-4036-9CF6-C6EB558A12FA Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
The epoch from following statement is incorrect,

test_db=3D# select extract(epoch from age(TIMESTAMP = '2013-02-18 06:15:15'));
 date_part 
-----------
 272396685
(1 = row)


The = correct value should be

test_db=3D# select (extract(epoch from now()) - = extract(epoch from TIMESTAMP '2013-02-18 06:15:15'));
     ?column?  =    
------------------
 272816228.311208
(1 = row)

They are several = days apart. Maybe leap years are not counted properly?

Postgresql = version:

PostgreSQL 11.12 on = x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red = Hat 

Let me know if you need more = information. Thanks!

Zhihong

= --Apple-Mail=_105794D5-5293-4036-9CF6-C6EB558A12FA--