Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iiWoR-0004Rp-9a for pgsql-admin@arkaria.postgresql.org; Sat, 21 Dec 2019 04:56:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iiWoN-0005Lt-SW for pgsql-admin@arkaria.postgresql.org; Sat, 21 Dec 2019 04:56:19 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iiWoN-0005Ll-JW for pgsql-admin@lists.postgresql.org; Sat, 21 Dec 2019 04:56:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iiWoK-0008FA-O0 for pgsql-admin@lists.postgresql.org; Sat, 21 Dec 2019 04:56:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xBL4uDtn027089; Fri, 20 Dec 2019 23:56:13 -0500 From: Tom Lane To: Ron cc: pgsql-admin@lists.postgresql.org Subject: Re: Partitioning by month causing an error? In-reply-to: <9fe4b503-4be4-4ed5-4299-d7c49c8921b4@gmail.com> References: <9226.1576897186@sss.pgh.pa.us> <8ba56626-3b91-6ac8-34a9-ab2c9ca2b8c6@gmail.com> <19102.1576901426@sss.pgh.pa.us> <9fe4b503-4be4-4ed5-4299-d7c49c8921b4@gmail.com> Comments: In-reply-to Ron message dated "Fri, 20 Dec 2019 22:31:35 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <27087.1576904173.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Fri, 20 Dec 2019 23:56:13 -0500 Message-ID: <27088.1576904173@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ron writes: > On 12/20/19 10:10 PM, Tom Lane wrote: >> This rule breaks fewer things than a rule of A <= X <= B would. > Why not?  For 20+ years (not on Postgres) I've been specifying partition > limits where the upper limits are the edge of timestamps (octaword integers > counting the number of 100ns ticks since November 17, 1858), and have > *never* had a problem: > IN ETC_TRAN_DETAIL_201909_UA WITH LIMIT OF '2019-09-30 23:59:59.99', > IN ETC_TRAN_DETAIL_201910_UA WITH LIMIT OF '2019-10-31 23:59:59.99', And what happens with '2019-10-31 23:59:59.9999'? I don't know about your other database, but in Postgres that value is legal and it's larger than '2019-10-31 23:59:59.99', but still less than '2019-11-01 00:00:00'. The main point here is that even if that works, it requires a whole lot more assumptions about the behavior of the datatype (specifically, its precision limit) than the other way. As soon as you look at cases where the precision limit isn't clearly defined, it just breaks. > Of course, I've also never partitioned a table on a float, thinking that's > utterly daft. [ shrug... ] Works fine as long as you have a non-daft partitioning rule. regards, tom lane