Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvmL7-0008J5-PS for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Sep 2017 15:27:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dvmL7-0006mP-6C for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Sep 2017 15:27:33 +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.84_2) (envelope-from ) id 1dvmL6-0006mF-Cf for pgsql-hackers@postgresql.org; Sat, 23 Sep 2017 15:27:32 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dvmL3-0005mV-QP for pgsql-hackers@postgresql.org; Sat, 23 Sep 2017 15:27:31 +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 v8NFRQKe024768; Sat, 23 Sep 2017 11:27:26 -0400 From: Tom Lane To: Tomas Vondra cc: PostgreSQL-development Subject: Re: user-defined numeric data types triggering ERROR: unsupported type In-reply-to: <4b444362-4240-49e0-3523-724e5932b060@2ndquadrant.com> References: <9389.1506003842@sss.pgh.pa.us> <4b444362-4240-49e0-3523-724e5932b060@2ndquadrant.com> Comments: In-reply-to Tomas Vondra message dated "Sat, 23 Sep 2017 16:38:32 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24766.1506180446.1@sss.pgh.pa.us> Date: Sat, 23 Sep 2017 11:27:26 -0400 Message-ID: <24767.1506180446@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Tomas Vondra writes: >>> [ scalarineqsel may fall over when used by extension operators ] > What about using two-pronged approach: > 1) fall back to mid bucket in back branches (9.3 - 10) > 2) do something smarter (along the lines you outlined) in PG11 Sure. We need to test the fallback case anyway. >> [ sketch of a more extensible design ] > Sounds reasonable to me, I guess - I can't really think about anything > simpler giving us the same flexibility. Actually, on further thought, that's still too simple. If you look at convert_string_to_scalar() you'll see it's examining all three values concurrently (the probe value, of one datatype, and two bin boundary values of possibly a different type). The reason is that it's stripping off whatever common prefix those strings have before trying to form a numeric equivalent. While certainly convert_string_to_scalar is pretty stupid in the face of non-ASCII sort orders, the prefix-stripping is something I really don't want to give up. So the design I sketched of considering each value totally independently isn't good enough. We could, perhaps, provide an API that lets an operator estimation function replace convert_to_scalar in toto, but that seems like you'd still end up duplicating code in many cases. Not sure about how to find a happy medium. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers