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 1h3vBx-0005XS-IJ for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Mar 2019 04:08:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h3vBv-0005aj-W0 for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Mar 2019 04:08:31 +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 1h3vBv-0005ac-Pd for pgsql-bugs@lists.postgresql.org; Wed, 13 Mar 2019 04:08:31 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h3vBn-0003SZ-Hi for pgsql-bugs@lists.postgresql.org; Wed, 13 Mar 2019 04:08:31 +0000 Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x2D48HSt021698; Wed, 13 Mar 2019 13:08:17 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 4D881EA7129; Wed, 13 Mar 2019 13:08:17 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 38C7CEA6DDD; Wed, 13 Mar 2019 13:08:17 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 20C224008A8; Wed, 13 Mar 2019 13:08:17 +0900 (JST) Subject: Re: BUG #15668: Server crash in transformPartitionRangeBounds References: <15668-0377b1981aa1a393@postgresql.org> <20190306064825.GH30982@paquier.xyz> <6ed2c24c-2f73-fa1c-0ed1-ed3597f13d0d@lab.ntt.co.jp> <20190306082730.GJ30982@paquier.xyz> <7846.1552408520@sss.pgh.pa.us> From: Amit Langote Message-ID: <1f9aaa7a-43d4-43ae-e270-14dbca926167@lab.ntt.co.jp> Date: Wed, 13 Mar 2019 13:08:01 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <7846.1552408520@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-CC-Mail-RelayStamp: 1 To: Tom Lane , Robert Haas Cc: Michael Paquier , Amit Langote , Alexander Lakhin , PostgreSQL mailing lists , PostgreSQL-development , Peter Eisentraut X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019/03/13 1:35, Tom Lane wrote: > Robert Haas writes: >> On Mon, Mar 11, 2019 at 2:45 AM Amit Langote >> wrote: >>> I noticed another issue with the code -- it's using strcmp() to compare >>> specified string against "minvalue" and "maxvalue", which causes the >>> following silly error: >>> >>> create table q2 partition of q for values from ("MINVALUE") to (maxvalue); >>> ERROR: column "MINVALUE" does not exist >>> LINE 1: create table q2 partition of q for values from ("MINVALUE") ... >>> >>> It should be using pg_strncasecmp(). > >> Uh, why? Generally, an unquoted keyword is equivalent to a quoted >> lowercase version of that same keyword, not anything else. Like >> CREATE TABLE "foo" = CREATE TABLE FOO <> CREATE TABLE "FOO". OK. Perhaps, I reacted too strongly to encountering the following behavior with HEAD: create table p1 partition of p for values from ("minValue") to (1); ERROR: column "minValue" does not exist but, create table p1 partition of p for values from ("minvalue") to (1); \d p1 Table "public.p1" Column │ Type │ Collation │ Nullable │ Default ────────┼─────────┼───────────┼──────────┼───────── a │ integer │ │ │ Partition of: p FOR VALUES FROM (MINVALUE) TO (1) But as you and Tom have pointed out, maybe it's normal. > Yeah. The behavior shown above is entirely correct, and accepting the > statement would be flat out wrong; it would cause trouble if somebody > created a table containing multiple case-variations of MINVALUE. Sorry, I didn't understand this last part. Different case-variations will all be interpreted as a minvalue (negative infinity) range bound and flagged if the resulting range bound constraint would be invalid. Did you mean something like the following: create table p1 partition of ... from ("minValue") to ("MINVALUE"); which using pg_strncasecmp() comparisons gives: create table p1 partition of p for values from ("minValue") to ("MINVALUE"); ERROR: empty range bound specified for partition "p1" DETAIL: Specified lower bound (MINVALUE) is greater than or equal to upper bound (MINVALUE). which is same as the behavior with unquoted keyword syntax: create table p1 partition of p for values from (minValue) to (MINVALUE); ERROR: empty range bound specified for partition "p1" DETAIL: Specified lower bound (MINVALUE) is greater than or equal to upper bound (MINVALUE). whereas quoted identifier syntax on HEAD gives: create table p1 partition of p for values from ("minValue") to ("MINVALUE"); ERROR: column "minValue" does not exist LINE 1: create table p1 partition of p for values from ("minValue") ... However, as you guys said, HEAD is behaving sanely. Thanks, Amit