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 1lOGZq-0002vs-7Q for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Mar 2021 09:10:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lOGZp-0006BR-5g for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Mar 2021 09:10:21 +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 1lOGZo-0006BK-VH for pgsql-hackers@lists.postgresql.org; Mon, 22 Mar 2021 09:10:20 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lOGZl-00035T-GM for pgsql-hackers@lists.postgresql.org; Mon, 22 Mar 2021 09:10:20 +0000 Received: by mail-ed1-x52f.google.com with SMTP id l18so10143432edc.9 for ; Mon, 22 Mar 2021 02:10:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=UbzdtqI4F01ZRvCQ1Lf/z0tlEFRNiSOUR5HVSF6QVHI=; b=YFSv98s2Rj2rYATAYYxGDM8Carynw8M4/VShhOU7UL4ViBRiOJwHBtS3aITnGYYbH7 IY/Htd+Ky/1XM94SuJc4bClfGVAo7lvtVNPWBIhYu0BANP5C9s5ggIisW1DL49oGtcw7 lCe3h5VR40Tjz6Hm0Bg8d9QGT2yXY4ZFYlPhRXYMe4Irdw+EF7e3TOZ2/keTY0AUMMjX hWvpaCMihPkXVU3s1ZSZjn4GmjR91IbvkXw9qyl3KMtvmS92b8aQPpMQAkSqgB2TnHBm QftQ2+IzK3j5vOm8jTvCH95f0iNsvzFAwUE9ntVdqeae7p6OfXwmMwx0LG0PVWpglPtv hAQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UbzdtqI4F01ZRvCQ1Lf/z0tlEFRNiSOUR5HVSF6QVHI=; b=D4tvJEZMpgJ9jrO09/tzlVaCzQz+5gN6f7tJDQq4+UelX8H6x2BWeA0sVeTHUzYrLk kMhtGf4JZ9DoJn98NWdP+KGDEXHlyQJsUFsdtwyF64dRSDBbYT3tVImOy8i/bOC8genM u8ljUAjfy3Gb9UJwo3Yv8e6Ys4R2umwpBngIp7sewtLLEIVLUZzVdndJbhHjj2REXYmA ebuz0M50TMwBX71QeLLFu4iX79h5xJZf87sYDXKfBmpS0W7x/6VmJx80vnjfRh+sqSMT c0809dls4b0zTcEPJ1Wl9iZLyqPKjQaDNOIY0CZlzHzx9d5Mun19kSYiCFxumFCwNx2c HuTw== X-Gm-Message-State: AOAM533w42E+q9CmiQeT2PeEfozIHtLzXhrWSup7V4DKYhN0m9iwhX9s HcVoMNFVRtEYy/2dEobKCdYtidR84zgkhIWy4oaJi7o9qwDHHt03m6vqBrImqaENenQ+UuF3JRI gar6LftTsCrtBCq2e4HbIr+gVlppsAnC6mPd5iWy70PPUPvqmEssamO6NvjIgEapjoXpvxD7uck oAkqKyiZFVCAF/1PfvbrnaD4uSlvz1Smhdj9jIeHoj6de1MzB9L8eFZgLtPYTfyC21vpsUoGT6D jTK6MckbASYdzTe7ixeb7qNmqpnO7tpOTT+ARUmfaS6h9E2RntAoA== X-Google-Smtp-Source: ABdhPJxcl5P7zJkozVUgxR+wIRmzIeyhiN7nOZXekIARw7iNvJoGztPSGIHl49T2z0rybmEAHTinrA== X-Received: by 2002:aa7:c150:: with SMTP id r16mr23959730edp.96.1616404216007; Mon, 22 Mar 2021 02:10:16 -0700 (PDT) Received: from [10.137.0.20] (ip-86-49-253-127.net.upcbroadband.cz. [86.49.253.127]) by smtp.gmail.com with ESMTPSA id z9sm11387870edr.75.2021.03.22.02.10.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Mar 2021 02:10:15 -0700 (PDT) Subject: Re: WIP: BRIN multi-range indexes From: Tomas Vondra To: John Naylor Cc: Alvaro Herrera , PostgreSQL Hackers References: <20210303001725.GA1766@alvherre.pgsql> <23a0a854-8f1a-e965-7121-f76b1b2fc271@enterprisedb.com> <8e319879-32ff-1eb8-d7d3-6a3ac8a51728@enterprisedb.com> <35e866e9-d820-07de-b2be-69d5ac479179@enterprisedb.com> <71dfd257-c5ce-530d-90d3-7c744a28e97b@enterprisedb.com> Message-ID: <54b47e66-bd8a-d44a-2090-fd4b2f49abe6@enterprisedb.com> Date: Mon, 22 Mar 2021 10:10:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/22/21 6:27 AM, Tomas Vondra wrote: > > ... > > All the regression tests work fine, with the exception of minmax-multi > on a CIDR column. I don't know why, but the CREATE INDEX then fails like > this: > > ERROR: missing operator 1(650,650) in opfamily 16463 > > 650 is cidr, so this essentially says there's no (cidr With the opclasses defined in .dat files this however worked, so I > suppose it's related to the missing operator families. > Turns out this is likely a bug elsewhere. After a couple fixes to the extension SQL script, the only real difference in catalog contents (compared to e.g. the built-in BRIN minmax inet opclass) is that the built-in one has opckeytype set to 869 (i.e. inet), while the one created from extension has it set to 0. The opclasses for inet (OID 869) look like this: test=# select oid, opcname, opcfamily, opcintype, opckeytype from pg_opclass where opcintype = 869 order by oid; oid | opcname | opcfamily | opcintype | opckeytype -------+-----------------------+-----------+-----------+------------ 10009 | cidr_ops | 1974 | 869 | 0 10010 | cidr_ops | 1975 | 869 | 0 10015 | inet_ops | 1974 | 869 | 0 10016 | inet_ops | 1975 | 869 | 0 10017 | inet_ops | 3550 | 869 | 0 10018 | inet_ops | 3794 | 869 | 0 10105 | inet_minmax_ops | 4075 | 869 | 869 10106 | inet_inclusion_ops | 4102 | 869 | 869 16451 | inet_bloom_ops | 16450 | 869 | 0 17398 | inet_minmax_multi_ops | 17397 | 869 | 0 (10 rows) The only difference between the two minmax variants is the opckeytype, and if I update it to 869 for inet_minmax_multi_ops, it starts working. Likewise, if I set it to 0 for inet_minmax_ops, it breaks the same way. Turns out, this is impossible to set from CREATE OPERATOR CLASS, because opclasscmds.c does this: /* Just drop the spec if same as column datatype */ if (storageoid == typeoid && false) storageoid = InvalidOid; but index.c looks only at opclassTup->opckeytype. The built-in opclasses don't have this issue, because they put the data into the catalog directly, without going through this code. I don't know what's the right fix, but it seems like this patch has nothing to do with it. If we want to move the opclasses into an extension, we can comment out that one (cidr/inet) case for now. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company