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 1ervmX-0001Ej-KV for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Mar 2018 01:16:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ervmV-0006Ly-FD for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Mar 2018 01:16:11 +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 1ervmV-0006Lo-80 for pgsql-hackers@lists.postgresql.org; Sat, 03 Mar 2018 01:16:11 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ervmL-0001sm-SJ for pgsql-hackers@postgresql.org; Sat, 03 Mar 2018 01:16:10 +0000 Received: by mail-wr0-x241.google.com with SMTP id f14so11785898wre.8 for ; Fri, 02 Mar 2018 17:16:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=DT9DuMLB9UqD9SVXJLkoz1GKGJpTZhkC8MA0gYOo3MQ=; b=v8Dpq/0JAqeeiOeR3R5pXTiqmIJGw0QrDEqPMuMCa2xPGlhArlC0wvtt8/VbsloRkP z+/QJUbOsUAvgC8EKMLQ7FoBZJ/1wgjlWsWf0/5jQSGyegxfvY/N1oUTVtshCP8R8QNd Vab6siYjS3DEQ2POrs2scH5uc3w4KHT8BFd4sVPstO3e8a8kjvL34C9qVTq8AYi/h5lN mIC9I8iVnuZ2tCZ9H7qLPzT/Hfy8zsSlSEMrBTIBVlbHw7AO0TjmKAmfmkZquXQZ1bCB 8ILgvLkg4yTaQ1sxh9WjqGLiIaV3ZHmsCBKW2D74RbpCQ1VJwNporjP11Et3vbD5y6RF QD2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DT9DuMLB9UqD9SVXJLkoz1GKGJpTZhkC8MA0gYOo3MQ=; b=rJSyQ+PXA94SH86jQL/pBu/NiK2MfXSKSELVOpyxFjOK2o0GNAooVJ5+wKSGSR8Y/k szNJexbd5wslJyim9XT15ThHJ/DImQxWMarumUhypZTq/+F8RfYcUMze2N/rdEr0dkKu ieFefj432iEKXPS92askIrL9J+uMBUH/FsJZY4NvGypMvq/GoqItFz3aAiNx/vNTs5xt J8nokf20+QukztCw5nntvKkFoT73UmKObvw97WeflIMQkDaHjvzUycV2dBeLbYdbb7jk PIlKSVj9jaWPjzrwCTCWJIzByetyliplixvGxL8CxD2WwohyJyBQR0ii1e4GMv0egKKB 3Pbg== X-Gm-Message-State: APf1xPDaktsauTdd8ESAUcebNuSP4qIBklGK6YOuFNdJiJ7gGquWYsoX 6eg+tMsv1nCfTxe1kqfeMLulLAxNhU0K/MDt4+omUAIWrKh8Wh0HhRqzPsr0neE/A1qOsyNTKRN KBOMVZqsEKkhO0NnFX5Zd2WLNE1vA0LZwETA34PgwU9EiVXjam9q2G9bFfetI73X3Iibpv/+dVw uD3Jh6If4H X-Google-Smtp-Source: AG47ELsVVwU21jkdQUZqj8nONe7DC3KwWq9fuvpXRixexGqDLOh+GRqpjV1N5DIYn+s+Kv1IzO3t7Q== X-Received: by 10.223.176.171 with SMTP id i40mr6756843wra.57.1520039760295; Fri, 02 Mar 2018 17:16:00 -0800 (PST) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id m191sm2025186wma.42.2018.03.02.17.15.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Mar 2018 17:15:59 -0800 (PST) Subject: Re: [HACKERS] user-defined numeric data types triggering ERROR: unsupported type To: Tom Lane Cc: PostgreSQL-development 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> From: Tomas Vondra Message-ID: <42f4e37e-f923-6ea9-4172-cdec5a8c2d25@2ndquadrant.com> Date: Sat, 3 Mar 2018 02:15:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <14597.1520038563@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 03/03/2018 01:56 AM, Tom Lane wrote: > 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. > Will do. > 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. > OK, I'll look into that too. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services