Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brmkx-0006PY-LX for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Oct 2016 14:01:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1brmkx-0001L6-7r for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Oct 2016 14:01:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1brmkw-0001Kj-Ma for pgsql-bugs@postgresql.org; Wed, 05 Oct 2016 14:01:10 +0000 Received: from mwork.nabble.com ([162.253.133.43]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brmkp-00088D-PT for pgsql-bugs@postgresql.org; Wed, 05 Oct 2016 14:01:10 +0000 Received: from mben.nabble.com (unknown [162.253.133.72]) by mwork.nabble.com (Postfix) with ESMTP id 0F7EA53F24DD0 for ; Wed, 5 Oct 2016 07:01:02 -0700 (MST) Date: Wed, 5 Oct 2016 07:01:02 -0700 (MST) From: mmerta To: pgsql-bugs@postgresql.org Message-ID: <1475676061981-5924559.post@n3.nabble.com> Subject: Wrong results of function age(timestamp, timestamp) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hello, I ecountered strange behaviour of function age(timestamp, timestamp). Let's say we have two timestamps and we want to compute their age() from fixed timestamp in past: SELECT pg_catalog.age('2016-04-30 00:00:01'::TIMESTAMP , '2015-01-01 12:00:00'::TIMESTAMP), pg_catalog.age('2016-04-29 23:59:59'::TIMESTAMP , '2015-01-01 12:00:00'::TIMESTAMP); age | age --------------------------------+-------------------------------- 1 year 3 mons 28 days 12:00:01 | 1 year 3 mons 28 days 11:59:59 Results are correct. If we add '1 day'::interval to original timestamps, both results should be 1 day longer. Howewer first result is exactly 24 hours longer than it should be: SELECT pg_catalog.age(('2016-04-30 00:00:01'::TIMESTAMP + '1 day'::INTERVAL), '2015-01-01 12:00:00'::TIMESTAMP), pg_catalog.age(('2016-04-29 23:59:59'::TIMESTAMP + '1 day'::INTERVAL), '2015-01-01 12:00:00'::TIMESTAMP); age | age --------------------------------+-------------------------------- 1 year 3 mons 30 days 12:00:01 | 1 year 3 mons 29 days 11:59:59 Am I missing something or is it a bug in function age(timestamp, timestamp)? I tested this on postgres versions 9.4.6 and 9.5.3 on CentOS 7, using timezone = 'Europe/Prague' in postgresql.conf. Regards Michal Merta -- View this message in context: http://postgresql.nabble.com/Wrong-results-of-function-age-timestamp-timestamp-tp5924559.html Sent from the PostgreSQL - bugs mailing list archive at Nabble.com. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs