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 1h1QM3-0002HA-IT for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Mar 2019 06:48:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h1QM1-0003T7-T3 for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Mar 2019 06:48:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1QM0-0003T0-0F for pgsql-bugs@lists.postgresql.org; Wed, 06 Mar 2019 06:48:37 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1QLw-0002Cj-OA for pgsql-bugs@lists.postgresql.org; Wed, 06 Mar 2019 06:48:34 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id D5BC123944; Wed, 6 Mar 2019 01:48:31 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 06 Mar 2019 01:48:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=mSgXLixSaRY4DpHdsHmzaflY43V 6Ll19GSVjDKKiing=; b=aeFkAJoSXNspBbubx/faFNX4JqbkdJcRPj136CK7/6C JonldwYrUIs3zvsmQjzHmodnuWsP5C+BOuRAdZ+moy9EDS9hWmQ3wJcE46mNd0ib s80x4NOC/WLZUFG5vrc05uFELGCKeGbtfuEtoBdzSBRCYRsFfDa9BitwW5u7T4j/ CaIEtloqaqqGrsaQMQOVCRyAV7khotDHhslfFHCCb5QDuRaeTzyw8QC3k82C8mDc ALjh4wUZH8AnVQtmgTpX/j8Y5hX/jR3bhMHPwyY+kuyOUHHcKrd7iEpUAqxiaVya OZC8zsgly3gABGjb4t7l0moK7PWPSjInWV8edcqGvKA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=mSgXLi xSaRY4DpHdsHmzaflY43V6Ll19GSVjDKKiing=; b=X3+Hq+FobIIS0XHq7nHFh2 CHdRFKrzt0lcuN3EWdpzvbNvrhxP25Z+xei717mMcyL8dj+hm8T0RDQs0bWYme0x 3n4uE/+MkWfhqsM5YDEJ8x4nhpqn4F3LP9S/jQY6ULIUNdvwg7ENBIm3Tj7Wy5Yp 80ZS7ZrqVtx2CRt5CSMTQXPd7ZTd3Rt8CARj4QRpJ9PFAj6e97ACxzTOUMzdnQPk /Pn2tb5jmDwgrxxu7I7qtlmvJLKJe29t0iV+jGoJsMIeEMe4tSmysLyEwj7SESw6 kHFlJ2U+Gj3PrWDpTjTulzVe4+BY7ocO8EyEaqEAylXyg7eB9wU7sSHnvPoAqiag == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrfeeggddutddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucfkphepiedurddvudehrddufeejrdduiedvnecurfgrrhgr mhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiinecuvehluh hsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id E5FE7100E5; Wed, 6 Mar 2019 01:48:28 -0500 (EST) Date: Wed, 6 Mar 2019 15:48:25 +0900 From: Michael Paquier To: Amit Langote Cc: exclusion@gmail.com, PostgreSQL mailing lists , PostgreSQL-development , Peter Eisentraut Subject: Re: BUG #15668: Server crash in transformPartitionRangeBounds Message-ID: <20190306064825.GH30982@paquier.xyz> References: <15668-0377b1981aa1a393@postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RwxaKO075aXzzOz0" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --RwxaKO075aXzzOz0 Content-Type: multipart/mixed; boundary="mYYhpFXgKVw71fwr" Content-Disposition: inline --mYYhpFXgKVw71fwr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 05, 2019 at 11:04:17PM +0900, Amit Langote wrote: > Maybe we should error out as follows in > transformPartitionRangeBounds(), although that means we'll get > different error message than when using list partitioning syntax: Hm. I don't think that this is a good idea as you could lose some information for the expression transformation handling, and the error handling becomes inconsistent depending on the partition bound strategy. It seems to me that if we cannot extract any special value =66rom the ColumnRef expression generated, then we ought to let transformPartitionBoundValue() and particularly transformExprRecurse() do the analysis work and complain if needed: =3D# CREATE TABLE rp_part PARTITION OF range_parted FOR VALUES FROM (unknown.unknown) TO (1); ERROR: 42P01: missing FROM-clause entry for table "unknown" LINE 1: ...p_part PARTITION OF range_parted FOR VALUES FROM (unknown.un... =3D# CREATE TABLE rp_part PARTITION OF range_parted FOR VALUES FROM (a.a.a.a.a.a.a.a.a.a.a.a) TO (1); ERROR: 42601: improper qualified name (too many dotted names): a.a.a.a.a.a.a.a.a.a.a.a LINE 1: ...p_part PARTITION OF range_parted FOR VALUES FROM (a.a.a.a.a.... What about something like the attached instead? Minus the test cases which should go to create_table.sql of course. -- Michael --mYYhpFXgKVw71fwr Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="partition-bound-crash.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_= utilcmd.c index a37d1f18be..ee129ba18f 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -3750,8 +3750,16 @@ transformPartitionRangeBounds(ParseState *pstate, Li= st *blist, IsA(linitial(cref->fields), String)) cname =3D strVal(linitial(cref->fields)); =20 - Assert(cname !=3D NULL); - if (strcmp("minvalue", cname) =3D=3D 0) + if (cname =3D=3D NULL) + { + /* + * No field names have been found, meaning that there + * is not much to do with special value handling. Instead + * let the expression transformation handle any errors and + * limitations. + */ + } + else if (strcmp("minvalue", cname) =3D=3D 0) { prd =3D makeNode(PartitionRangeDatum); prd->kind =3D PARTITION_RANGE_DATUM_MINVALUE; --mYYhpFXgKVw71fwr-- --RwxaKO075aXzzOz0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlx/bTkACgkQnvQgOdby QH26WBAAi8E5ocTO+OfCHREAXPzk7V3m+j4IKjVauxmx+OxJbqj9Sa9KYzrOpeJ8 crSYBxyfPFu8kT8DYh6GhaJftmaJZel6zE10mVhk8Oq+BIqw37zFZPU3KI/N6ozN n1JFand9FrtSdu5U32iA74HYRc+tnnza4T/V+uuUWc9Q0FgVnTB8mPE//QEOVKO1 Lqie3y/vg6nFhLwrz5t1waXSko5716TGGnQlBC9W+Uw3o4X/DtmFqshvdYjeGDgA 4JOkYJE46H7lQ+YYtJKxGPYxTvHSPBjUgON4EaJSuEfsOeECDOkgkUtcV1REn/mx VZHcqTulMeHnmhEBAc9Ogr3it2rHfwADUOhb4IjFVTHrfSSxRF9h8ySnuNNvFht0 FJq2wGzzpo4gKncptbkD4D4P8TCZoyJEy4nWHNcqfUJdqh3ZXmOzkCbJ+duZLTqY 8oQ2F1MxVUBa8yJyIrZgGrEn3VSvv9NcNw46XNE+sqtHc0WI7X++UjRIlKGgR+I+ azReIX9PN37Ne5V9930tdS2lrt4ASbLhvAdTS0YsHd6eQQeSTltjmhbdSX6kgLnk FsF6oFrWWlZg/o7ykvTmRhmIjAkHq+2/xlXFcsmNcDGaVZOd1OJgt01jciW3O86k VLT9HQ/cVGCOCT+JFSxbHxCnDGM/LUz5DCDsvpEV+UBIvYF9KLA= =VdqA -----END PGP SIGNATURE----- --RwxaKO075aXzzOz0--