Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJXUf-0006ZA-Pc for pgsql-bugs@arkaria.postgresql.org; Wed, 01 Apr 2020 07:08:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJXUe-0006a0-Me for pgsql-bugs@arkaria.postgresql.org; Wed, 01 Apr 2020 07:08:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJXUd-0006XH-MG for pgsql-bugs@lists.postgresql.org; Wed, 01 Apr 2020 07:08:56 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJXUZ-0004XF-O8 for pgsql-bugs@lists.postgresql.org; Wed, 01 Apr 2020 07:08:55 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 4A2B35E6; Wed, 1 Apr 2020 03:08:48 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 01 Apr 2020 03:08:48 -0400 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=7rX7Y433km4r58y6ysCfkTSKscH ucTb5Ht/9F1nlyJk=; b=HAESe9PNeV8X4OVI0GE3cICj1PMjw7ONcuG2ShwIkqB 7OBXvclhAomoHL3wGIn67rANxonuOup5cvLC9xPn8QyWD+3gUpitdV72BjmZWZLs W6E7cKv8A65dt9r4bGmWUISX9/sx61z7FP5SeUzYf6H9YSE3Gny0GaIwg7iOr6Ky IYwMotvAh/Woon1wrW0dXwH7Nf/gy8t+qbLwdZ/ZJpL9R7GYKS/rKz4yDt2sZlFj YEWeOKc/RlPm15YAcpf7Aa4tb6DXMUaFcp1LdSeo6B0gdjuE5z5Zf35OxnxolAVg H3mB2nIjKLtRDHUavJw/IroMPksLo8j5eKvVp3QPl0Q== 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=7rX7Y4 33km4r58y6ysCfkTSKscHucTb5Ht/9F1nlyJk=; b=YXpWZUlR1ZG7t9Z5hI92On 6WwZyw7Ref33I/QYw/76fae5GZwA3z6ZBNKCJ+7PPAcKMUmZsDKBBG7OYcY49b+J VDYgKXk7fSi+XKCltkvBlgdwHsxcfO6Yx3ESuliJEL4izhrUQUfNWNs5kAJkW2Dn 01Rc+DwZPa5IQQrRlCFcZdRRv44i416TZPqm6w0vAgAn3fmFvmTVbjStCIOYig65 wFhS7irxXkuQGZLWzX9BVb5eI9epUdWJW255vXPCn3Rrf48JhSa/Sc4OFbk8gncZ uW57vPVQLUiK1IB6yhFLRPo9LmcpA/UQSvm6DEql5xpKoLLHKVtpaEKW4U+2An+Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtddugdejjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdejtddmnecujfgurhepfffhvf fukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhi vghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecukfhppeduudekrddvge durddvgeekrdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Received: from paquier.xyz (mp76f1f804.ap.nuro.jp [118.241.248.4]) by mail.messagingengine.com (Postfix) with ESMTPA id E58CF306CC82; Wed, 1 Apr 2020 03:08:45 -0400 (EDT) Date: Wed, 1 Apr 2020 16:08:42 +0900 From: Michael Paquier To: Dmitry Dolgov <9erthalion6@gmail.com> Cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16325: Assert failure on partitioning by int for a text value with a collation Message-ID: <20200401070842.GD142683@paquier.xyz> References: <16325-809194cf742313ab@postgresql.org> <20200328125303.4me6vetvzgebobw5@localhost> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="llIrKcgUOe3dCx0c" Content-Disposition: inline In-Reply-To: <20200328125303.4me6vetvzgebobw5@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --llIrKcgUOe3dCx0c Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 28, 2020 at 01:53:03PM +0100, Dmitry Dolgov wrote: > Thanks for reporting! Looks like transformPartitionBoundValue needs to > check that the source collumn is collatable, then we get more expected > result: >=20 > =3D# create table part_coll partition of parted for values in ('1' co= llate "POSIX"); > ERROR: 42804: collations are not supported by type integer We have here a side effect of 7c079d74, that has given the possibility to pass down general expressions for partition bounds. > + if (type_is_collatable(colType)) > + { > + if (!OidIsValid(exprCollOid)) > + ereport(ERROR, > + (errcode(ERRCODE_INDETERMINATE_COLLATION), > + errmsg("could not determine which collation to = use for partition expression"), > + errhint("Use the COLLATE clause to set the coll= ation explicitly."))); > + } > + else > + { > + if (OidIsValid(exprCollOid)) > + ereport(ERROR, > + (errcode(ERRCODE_DATATYPE_MISMATCH), > + errmsg("collations are not supported by type %s= ", > + format_type_be(colType)))); > + } > + It seems to me that the first error cannot happen, and should not happen. When the expression is transformed, there is a lookup at the collation used via transformCollateClause() -> LookupCollation() -> get_collation_oid() which would never return an invalid OID if the collation exists, throwing an error instead. The reason why a similar check exists in tablecmds.c is that there can be a collation override, no? -- Michael --llIrKcgUOe3dCx0c Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl6EPfoACgkQnvQgOdby QH2CGhAAnvMN/UaBS26V9YofgvkoZeXn/OBMvWssf4dtsupoXp/9+csNiXZHJhrM Dl/TPolNDq5VYdADGtJFNBGaFILnb+/pg8f+kNixXdRVHPC1Qv9OMkvCpEGmmhFo mVs0bSWAuLvWc0FrVuSR8l1hYSDe9UcPGV5iRMyqqzthnQvLNV8j1Do0C/EspLC0 cm8T+VoZs3/2nPkvjsW1y7Uhgk4ShAuuDKxlXVn9bsxp5R0+t2ZpA1TVzfo77Wd9 z2KQZ7Bp8NZa2TWntiU3L3A/5vZT4ufiGXr9wsoi7X/HiLFie+7NNomNXvrvsdiL p9LlUXAZMuH6GVxlzzPOlSxzPJSFFWhSg7DWzsFziLyiX+l7iNZiQ4RZ+/Txqw8w Q6oL4rPtIPEmZYqylNKjrILXujmn6w21BPLxouSuFdcJoYXfYkR4lu0OrRsGKrOP YH66K8vvWJFOQNfRpkrxWRplaxQrk5qfDKBy7IyIOUFJEQvdu7ZF/FQGHfy8y9cN Swr7lGVHHjcPfRzWO6dl5ykffXEDeU+riYQf1gq33orfwB7EtIKOzeliLMnJ42Sa P0YhzhWZsJu/gRq0MijBoBCqDMCWbVitR3IfZ7p2kf+Q69VFNEqwAAQ0rEe+vcP8 mY9fhtMagAR/Wu5Ck0I7IfmTtKw2d6Xc3wOKFeBpw2j3tT2vIz8= =8j6U -----END PGP SIGNATURE----- --llIrKcgUOe3dCx0c--