Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r500z-00BLOx-UV for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Nov 2023 08:52:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r500x-006uUQ-Ou for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Nov 2023 08:52:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r500x-006uTT-Ab for pgsql-hackers@lists.postgresql.org; Mon, 20 Nov 2023 08:52:19 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r500u-007ORY-0w for pgsql-hackers@postgresql.org; Mon, 20 Nov 2023 08:52:18 +0000 Received: from [10.10.20.55] (node-7s8.pool-101-109.dynamic.totinternet.net [101.109.39.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: a.lepikhov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id A9717E20C39; Mon, 20 Nov 2023 11:52:11 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1700470334; bh=lPxCfPwgE6/UNiJQbs2vVUtA4/YspWPOhiu4O2N103A=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=W5n54y5wP4FTCLb78bzbQYe4MlNu4QKmqww7zO9NvhbExseEr6P71usXOXhG/cOU5 nTqilnaJGwVM3QjhfUvLEm0ns5U7TSeWQ/dBMm6n6YFLgJgvtpvLjZ+vzCbILBTWET Z1K3Wbqx5tz20tab+HOy3iR8c09M55KWwXy4cWUizJ7RqXSP+hGmfRAV6hM4fy6Yre 7C7JBRJtPxI79g7jNdBpZm6J/bROe0cvYov7FWV81W/XynJh3ss7R3B9/iPCxPZHLL V9N8wfTZiDAruc2RmyXUR0ao9BCDb/7IC5rujXTeX/NxscqWYLwmSV2c1mm+CgxuZt d9hM/Y+T8Nb6Q== Content-Type: multipart/mixed; boundary="------------7JHl1Maqe9K077Xsi4y6HXMp" Message-ID: <28c727ba-5260-42a8-88b0-4ecdeeca6ef8@postgrespro.ru> Date: Mon, 20 Nov 2023 15:52:08 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: POC, WIP: OR-clause support for indexes Content-Language: en-US To: Alena Rybakina , pgsql-hackers@postgresql.org Cc: Peter Geoghegan , Robert Haas , "Finnerty, Jim" , Marcos Pegoraro , teodor@sigaev.ru, Ranier Vilela , Tomas Vondra , Peter Eisentraut , Alexander Korotkov References: <567ED6CA.2040504@sigaev.ru> <89fb769c-7d45-f0c5-a9b3-b706c9661c57@postgrespro.ru> <668892c1-fb11-3a79-ce5e-1c194b7b3263@postgrespro.ru> <16a7e3aa-24c0-4986-8820-ea2857bd7b6b@postgrespro.ru> <421656a9-5df7-41bb-9d58-1c1edbd5dc3e@postgrespro.ru> From: Andrei Lepikhov Organization: Postgres Professional In-Reply-To: <421656a9-5df7-41bb-9d58-1c1edbd5dc3e@postgrespro.ru> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------7JHl1Maqe9K077Xsi4y6HXMp Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 10/11/2023 16:20, Alena Rybakina wrote: >> I added log like that: ERROR:  unrecognized node type: 0. > I fixed this issue and added some cosmetic refactoring. > The changes are presented in the or_patch_changes.diff file. Looking into the patch, I found some trivial improvements (see attachment). Also, it is not obvious that using a string representation of the clause as a hash table key is needed here. Also, by making a copy of the node in the get_key_nconst_node(), you replace the location field, but in the case of complex expression, you don't do the same with other nodes. I propose to generate expression hash instead + prove the equality of two expressions by calling equal(). -- regards, Andrei Lepikhov Postgres Professional --------------7JHl1Maqe9K077Xsi4y6HXMp Content-Type: text/plain; charset=UTF-8; name="changes.txt" Content-Disposition: attachment; filename="changes.txt" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy9iYWNrZW5kL3BhcnNlci9wYXJzZV9leHByLmMgYi9zcmMvYmFj a2VuZC9wYXJzZXIvcGFyc2VfZXhwci5jCmluZGV4IDI1YTQyMzVkYmQuLmRlMjdkMjY0NmMg MTAwNjQ0Ci0tLSBhL3NyYy9iYWNrZW5kL3BhcnNlci9wYXJzZV9leHByLmMKKysrIGIvc3Jj L2JhY2tlbmQvcGFyc2VyL3BhcnNlX2V4cHIuYwpAQCAtMTc4LDYgKzE3OCwxMCBAQCB0cmFu c2Zvcm1Cb29sRXhwck9yKFBhcnNlU3RhdGUgKnBzdGF0ZSwgQm9vbEV4cHIgKmV4cHJfb3Jp ZykKIAlIVEFCIAkJICAgKm9yX2dyb3VwX2h0YWIgPSBOVUxMOwogCWludCAJCQlsZW5fb3Jz ID0gbGlzdF9sZW5ndGgoZXhwcl9vcmlnLT5hcmdzKTsKIAorCS8qIElmIHRoaXMgaXMgbm90 IGFuICdPUicgZXhwcmVzc2lvbiwgc2tpcCB0aGUgdHJhbnNmb3JtYXRpb24gKi8KKwlpZiAo IW9yX3RyYW5zZm9ybV9saW1pdCB8fCBleHByX29yaWctPmJvb2xvcCAhPSBPUl9FWFBSIHx8 IGxlbl9vcnMgPCAyKQorCQlyZXR1cm4gdHJhbnNmb3JtQm9vbEV4cHIocHN0YXRlLCAoQm9v bEV4cHIgKikgZXhwcl9vcmlnKTsKKwogCU1lbVNldCgmaW5mbywgMCwgc2l6ZW9mKGluZm8p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