Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fliyU-0006ri-8c for pgsql-bugs@arkaria.postgresql.org; Fri, 03 Aug 2018 22:55:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fliyR-0000um-MT for pgsql-bugs@arkaria.postgresql.org; Fri, 03 Aug 2018 22:55:07 +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.89) (envelope-from ) id 1fliyR-0000uf-GV for pgsql-bugs@lists.postgresql.org; Fri, 03 Aug 2018 22:55:07 +0000 Received: from cat-porwal-prod-mail1.catalyst.net.nz ([2404:130:4080::4]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fliyM-0001GK-PB for pgsql-bugs@lists.postgresql.org; Fri, 03 Aug 2018 22:55:06 +0000 Authentication-Results: auth=pass smtp.auth=mark.kirkwood@catalyst.net.nz smtp.mailfrom=mark.kirkwood@catalyst.net.nz Received: from [IPv6:2406:e001:b97:1:adda:d5ea:54da:ce3e] (unknown [IPv6:2406:e001:b97:1:adda:d5ea:54da:ce3e]) (Authenticated sender: mark.kirkwood@catalyst.net.nz) by cat-porwal-prod-mail1.catalyst.net.nz (Postfix) with ESMTPSA id 617E580CFE for ; Sat, 4 Aug 2018 10:54:53 +1200 (NZST) To: pgsql-bugs@lists.postgresql.org From: Mark Kirkwood Subject: Range partition creation failing due to incorrectly deciding lower bound greater than upper Message-ID: Date: Sat, 4 Aug 2018 10:54:52 +1200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I'm seeing a partition failing to create (10.4 built from src on Ubuntu 18.04, default db parameters): part=# CREATE TABLE date_fact(    id  INTEGER NOT NULL,    dte TIMESTAMPTZ NOT NULL,    val INTEGER NOT NULL) PARTITION BY RANGE (dte); CREATE TABLE part=# CREATE TABLE date_fact_2020 PARTITION OF date_fact FOR VALUES FROM ('2018-09-30 01:54:00.625000') TO ('2018-09-30 02:34:42.031250'); CREATE TABLE part=# CREATE TABLE date_fact_2021 PARTITION OF date_fact FOR VALUES FROM ('2018-09-30 02:34:42.031250') TO ('2018-09-30 03:15:23.437500'); ERROR:  empty range bound specified for partition "date_fact_2021" DETAIL:  Specified lower bound ('2018-09-30 03:34:42.03125+13') is greater than or equal to upper bound ('2018-09-30 03:15:23.4375+13'). Err, that is weird - where did '2018-09-30 03:34:42.03125+13')come from? I initially ran into this creating 4096 partitions (yeah, I know that is probably too many), but it reproduces in the above case with only 2. regards Mark