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 1ervWk-0008RG-RK for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Mar 2018 00:59:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ervWk-0007ia-2e for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Mar 2018 00:59:54 +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.89) (envelope-from ) id 1ervTB-0002xH-6A for pgsql-hackers@lists.postgresql.org; Sat, 03 Mar 2018 00:56:13 +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.89) (envelope-from ) id 1ervT3-0001Ro-Sf for pgsql-hackers@postgresql.org; Sat, 03 Mar 2018 00:56:12 +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 w230u3JW014598; Fri, 2 Mar 2018 19:56:03 -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> Comments: In-reply-to Tomas Vondra message dated "Wed, 28 Feb 2018 17:49:46 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14596.1520038563.1@sss.pgh.pa.us> Date: Fri, 02 Mar 2018 19:56:03 -0500 Message-ID: <14597.1520038563@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tomas Vondra writes: > OK, time to revive this old thread ... >>> [ scalarineqsel may fall over when used by extension operators ] > Attached is a minimal fix adding a flag to convert_numeric_to_scalar, > tracking when it fails because of unsupported data type. If any of the 3 > calls (value + lo/hi boundaries) sets it to 'true' we simply fall back > to the default estimate (0.5) within the bucket. I think this is a little *too* minimal, because it only covers convert_numeric_to_scalar and not the other sub-cases in which convert_to_scalar will throw an error instead of returning "false". I realize that that would be enough for your use-case, but I think we need to think more globally. So please fix the other ones too. I notice BTW that whoever shoehorned in the bytea case failed to pay attention to the possibility that not all three inputs are of the same type; so that code is flat out broken, and capable of crashing if fed dissimilar types. We ought to deal with that while we're at it, since (IMO) the goal is to make convert_to_scalar fail-soft for any combination of supplied data types. regards, tom lane