Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1esIb9-0008ES-At for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Mar 2018 01:37:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1esIb7-00012N-VL for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Mar 2018 01:37:57 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1esIb7-00012C-LA for pgsql-hackers@lists.postgresql.org; Sun, 04 Mar 2018 01:37:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1esIb5-0006NT-B6 for pgsql-hackers@postgresql.org; Sun, 04 Mar 2018 01:37:56 +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 w241brOs011917; Sat, 3 Mar 2018 20:37:53 -0500 From: Tom Lane To: Tomas Vondra cc: PostgreSQL-development Subject: Re: [HACKERS] user-defined numeric data types triggering ERROR: unsupported type In-reply-to: References: <9389.1506003842@sss.pgh.pa.us> <4b444362-4240-49e0-3523-724e5932b060@2ndquadrant.com> <24767.1506180446@sss.pgh.pa.us> <14597.1520038563@sss.pgh.pa.us> <42f4e37e-f923-6ea9-4172-cdec5a8c2d25@2ndquadrant.com> Comments: In-reply-to Tomas Vondra message dated "Sat, 03 Mar 2018 19:03:07 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11915.1520127473.1@sss.pgh.pa.us> Date: Sat, 03 Mar 2018 20:37:53 -0500 Message-ID: <11916.1520127473@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tomas Vondra writes: > Here is v2 of the fix. It does handle all the convert_to_scalar calls > for various data types, just like the numeric one did in v1 with the > exception of bytea. Pushed with some adjustments. > The bytea case is fixed by checking that the boundary values are > varlenas. This seems better than checking for BYTEAOID explicitly, which > would fail for custom varlena-based types. At first I've been thinking > there might be issues when the data types has mismatching ordering, but > I don't think the patch makes it any worse. I didn't like this one bit. It's unlike all the other cases, which accept only specific type OIDs, and there's no good reason to assume that a bytea-vs-something-else comparison operator would have bytea-like semantics. So I think it's better to punt, pending the invention of an API to let the operator supply its own convert_to_scalar logic. > I've also added a bunch of regression tests, checking each case. The > bytea test it should cause segfault on master, of course. I was kind of underwhelmed with these test cases, too, so I didn't commit them. But they were good for proving that the bytea bug wasn't hypothetical :-) regards, tom lane