Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2ZbV-0007f1-T8 for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Oct 2017 09:16:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e2ZbV-00080E-Fv for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Oct 2017 09:16:33 +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 1e2Zam-0006j0-IK for pgsql-bugs@postgresql.org; Thu, 12 Oct 2017 09:15:48 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2Zaj-0007hu-Mj for pgsql-bugs@postgresql.org; Thu, 12 Oct 2017 09:15:48 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 6AE0D21C1D0B; Thu, 12 Oct 2017 12:15:44 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from zakirov.localdomain (unknown [192.168.27.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 4284821C1CC9; Thu, 12 Oct 2017 12:15:44 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1507799744; bh=EsXQ/e5K9Wk/NlE62jtz/D1936QDXVur7RS89HAe8O8=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=T3R4bOnAH6ItJLqBPk3G4P2+ujuSTEgrobpwkYhA096D/K/MkNJyBuEiuSt9OQBzd CS9jlFcxuFExJ3npmR2VXV1mCDeBTJ1vob3Hj5myLQ+7IsbyVXX86ludt144qB6bpB 7jZjEGOmSa/STyo1iNlZiphKRdOev3mkLjDvBdkw= Date: Thu, 12 Oct 2017 12:15:43 +0300 From: Arthur Zakirov To: kes-kes@yandex.ru Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14850: Implement optinal additinal parameter for 'justify' date/time function Message-ID: <20171012091542.GA8159@zakirov.localdomain> References: <20171011103512.1452.9244@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171011103512.1452.9244@wrigleys.postgresql.org> User-Agent: Mutt/1.9.1 (2017-09-22) 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 On Wed, Oct 11, 2017 at 10:35:12AM +0000, kes-kes@yandex.ru wrote: > > >Adjust interval so 30-day time periods are represented as months > > https://www.postgresql.org/docs/9.6/static/functions-datetime.html > Yes, it seems that it is because timestamp operations return '29 days': =# SELECT timestamp '2016-01-31' +interval '1 month' -timestamp '2016-01-31'; ?column? ---------- 29 days You can also try the following, maybe it is appropriate for you: =# SELECT timestamp '2016-01-31' -timestamp '2016-01-31' +interval '1 month'; ?column? ---------- 1 mon =# SELECT extract( month from justify_days( timestamp '2016-01-31' -timestamp '2016-01-31' +interval '1 month') ); date_part ----------- 1 -- Arthur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs