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 1jogv2-00064x-Ea for pgsql-general@arkaria.postgresql.org; Fri, 26 Jun 2020 05:28:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jogv1-0001ky-Bi for pgsql-general@arkaria.postgresql.org; Fri, 26 Jun 2020 05:28:55 +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 1jogv1-0001ko-2I for pgsql-general@lists.postgresql.org; Fri, 26 Jun 2020 05:28:55 +0000 Received: from mout.gmx.net ([212.227.15.19]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1joguu-0007VN-G5 for pgsql-general@lists.postgresql.org; Fri, 26 Jun 2020 05:28:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1593149324; bh=B5Htt8qY8o/BLeHTeb52oTi/zNthYWTa5NQVXdaGegs=; h=X-UI-Sender-Class:To:From:Subject:Date; b=UhRRxWQOD6YlhRVMhrCNDQyVgSL7QqRmE+OprBWDZYbKNR0kYgJPHo/gWaQ9FttxJ tzzby4WXiois9BKg78cPm2yZnCT0bfynA1bBsa7eVg3ZokdgEwHSzcR+t7OPG3XKYJ djgpY6IYefApZgz4W2FYvXRufVzvCMBgpX+lHOj4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.25] ([188.174.165.13]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MLiCo-1jXA441452-00Heo3 for ; Fri, 26 Jun 2020 07:28:44 +0200 To: pgsql-general@lists.postgresql.org From: Thomas Kellerer Subject: timestamp - timestamp result Message-ID: Date: Fri, 26 Jun 2020 07:28:43 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:iKvCTFurnfkoZyycRueCRbHE2LuuzMoLbFaQ3r42bdJ/aiGZTC4 EMVihZxSdZUWCtDy/HvHlkK4zjdElJWbWwKZJYXsZl09u3KgjSGLVDlWCYrpNCN2ZhtmxVR rw4d5fYrafRjxKEH/RsrRYznW1mMV+XXLuluZ1ZKWDOFnmXg6Gl4tvrEnUNxV0+f1G7Bj98 98+e7BLPb/au8PHM5yJLA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:WqRosb8N28w=:HG1b5/blycWv5Dhl59z4Cc KwWjU9qtDywtuE4Y6X8ghGN0xEdZJM3UjPoXP8iYeus6YEJVUIVg0g4Kqs25Gb98XXNU+P21r kpsVYD9JcCJIGUV2Lna37IiVwT6adKpKMVx9SGdqAQUE0HIIzYs8ovyTlSaNh5Fb0iE8tPJ0d Kg8/SH202v9dkorGGhN+GDGXrUuuXgBath2w3wVopGQiDWuX8GVZcP/gdhLpaXjRRIYmBDrzU lqM8rkXkbsPQ0WOVxUb8OnKxRUxNXwjox+64V7KhH2ntkkbcafxHImswauj6Sd/l8gcAE5FAv Z/X/DYWURBtfyFye8jdOGq6OjpL/qS4QwZ35BnmZFYn5yYEuKsAqrD45R+4rGzS+TS4CVYXIQ 4F3C7dri8UTNxR6cFb7V9ujVGBUDbW6VVH1mxT2W4W6ZcMftcwWAjzWWdQHheAUrAEQ17x7ZA lxQruRsPTJ1j3T99SKiZVcLX7OKeHUWKBWWuxCUGUUi+s54WBVFOrz0uhNA2jWniKWq3zvvWE 4Bbma9YODqhWnUZG01iD9BdSGsJ91br4mXZylytil8BFp9fog3WtEBsHWxapdbwWXYd0A9jjS lSIU7xyTlEW1iBKFgwG+VMOc3FDzfU7PieINyfktsc53xDpShRuUM/QXwBzREsz4jkJf5DGcq MnBQgNipq8RPEzi2pcUPsVUwsJo1SUwTcjZwOeib01N5twaPA5AIVkcVzPuwTjx6wbqgVT1B8 1o1bwx628fq/eRFgHQkafKepxDCALuWx2oJJXkEck3ye7wmgKBZfZf4PqQCOJmATpDruC+zDh dUOH44TOVvUsRd181p43XvIo6BwjziXvyBNRNWCHidmiG4GZ0rplwak1vYT2brZB4z/G8D7Dx pWWs/MLm1ukcuQclK5uLpeOWx9RXqAMDJHwB9C7c3wP0+lBiJAlSDDZ/vNtf0z6LgHBskpwh2 lwpMHgRVnxLIic82ZOuLQlSY34jK+hEOWx1bCkqzSQHBXhMX7cy1ajBlH68dBbKJr5kLodrFi KF0QVo95BqR35ik0nMCEvnoiikjc1pCIYZ/tUT1JKVHjyUyCSDDUmb2lhrKwXjKLuCLlVg2Gu jdQyPitiUmbHtWXgjKASB7evBFHxn6T39+NUiYRXyN+paxPKofnTZF7/4E3fbZhXop0yhL6Mb V70HuFVOg9BXubHGxJpA3yM/VUVxDvpJvEcFNwMxqrjPsV60/WlFvmjowAEyN3ZDo1JQE= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I regularly see people suggesting to use extract(day from one_timestamp - other_timestamp) to calculate the difference between two timestamps in days. But I wonder if the "format" of the resulting interval is guaranteed to on= ly have days (and not months or years) The following: timestamp '2020-06-26 17:00:00' - timestamp '2019-04-01 14:00:00' returns an interval like this: 0 years 0 mons 452 days 3 hours 0 mins 0.0 secs However, is there ever a chance that the expression will yield the (equiva= lent) interval: 1 years 2 mons 25 days 3 hours 0 mins 0.0 secs e.g. as the age() function does. Is it safe to assume that "timestamp - timestamp" will never contain units= larger then days? Thomas