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 1u0M3p-00H5Iv-5M for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Apr 2025 15:00:53 +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 1u0M3n-008HGi-AH for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Apr 2025 15:00:51 +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 1u0M3m-008HGa-Ui for pgsql-hackers@lists.postgresql.org; Thu, 03 Apr 2025 15:00:51 +0000 Received: from dd48506.kasserver.com ([85.13.164.188]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u0M3k-003B9H-1k for pgsql-hackers@lists.postgresql.org; Thu, 03 Apr 2025 15:00:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oopsware.de; s=kas202503021101; t=1743692445; bh=eJuWF59mY7aBdp1ChnEikMVIKtZSh6+PkgdwIt8kN14=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ZaSfz9xmABuXDkSDVGolb6GupR+lqdDOAHzdpo8JsQl3AcEJLV4U+XObeJFBLb9mU scWNK97V7YwBscbfyDb/YJ0idZyjE051XkNQMm5hwkm6Q2fis6ICtz1nr8mMpNlKZE JzQJLJcqHUnTefhDZ4dGccGIzcLiT/xyYuKw/qxlAH32WWg8COwoImlOTvn/isQfNo Or0KOL9gaM2B96aufQ7lUA/B3mXPS0dfIDnorDFVhM56G23V/mGkYDS8nDmi5ir6Zt 7Q2P2RrqFlzefoqq0zrhBzMY0nRxK3mdSWbIhzqJFa8TwEWGrMDMkW0fuO216qmycy THqkaKJctqqLQ== Received: from sethos.at.struktu.ro (sethos.at.struktu.ro [46.4.183.126]) by dd48506.kasserver.com (Postfix) with ESMTPSA id 4147D86657E8; Thu, 3 Apr 2025 17:00:45 +0200 (CEST) Received: from chufu.bluecherstrasse.oopsware.lan (i5C75098A.versanet.de [92.117.9.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sethos.at.struktu.ro (Postfix) with ESMTPSA id 9918441C22A1; Thu, 3 Apr 2025 17:00:43 +0200 (CEST) Message-ID: Subject: Re: [PATCH] Add sortsupport for range types and btree_gist From: Bernd Helmle To: Heikki Linnakangas , Andrey Borodin Cc: Michael Paquier , jian he , PostgreSQL Hackers Date: Thu, 03 Apr 2025 17:00:43 +0200 In-Reply-To: <2d3078fa-4700-431f-99a5-91ae8ee3bf86@iki.fi> References: <7C9400DF-66FE-4308-BAD8-92FE3D0E55C6@yandex-team.ru> <0d9fbd59de15e2fc987a850c3d1f8a79a6ede825.camel@oopsware.de> <19c62e62c79b727d2c9a82eaeecfea5017001099.camel@oopsware.de> <4BADF8DD-A4D3-43AA-AA08-037F6FFA40BC@yandex-team.ru> <61128550659807032dd29c8c8a71674c818cbbb6.camel@oopsware.de> <7095B5FA-FADB-4524-B858-ECD14998710B@yandex-team.ru> <0176b173adfcff250543fe0aee2ef6137bd71953.camel@oopsware.de> <78499920f1e9ed5895423e735272ca2fdb90baf6.camel@oopsware.de> <770DB2DA-0B56-464A-87CE-5620CF12E114@yandex-team.ru> <6bd891c9e3aa12baea5c938267bdb5a1e50a299e.camel@oopsware.de> <64d324ce2a6d535d3f0f3baeeea7b25beff82ce4.camel@oopsware.de> <2d3078fa-4700-431f-99a5-91ae8ee3bf86@iki.fi> Autocrypt: addr=mailings@oopsware.de; prefer-encrypt=mutual; keydata=mQGiBEIM4dYRBACEnxQZ/CfR1xbCJzGOIjvh3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67w7QjQmVybmQgSGVsbWxlIDxtYWlsaW5nc0Bvb3Bzd2FyZS5kZT6 IXgQTEQIAHgUCQhyPxgIbAwYLCQgHAwIDFQIDAxYCAQIeAQIXgAAKCRBRdc2OhdlKzOhrAJ4w+A3H cjTJb54lUDpyyQu6Y5dlVQCeJCFKygOVbpn4HSp4Z+R6+s4Rul60J0Jlcm5kIEhlbG1sZSA8YmVyb mQuaGVsbWxlQGN5YmVydGVjLmF0Poh4BBMRAgA4FiEEcLVWcrwQIdBqHtvMUXXNjoXZSswFAmDe1D kCGwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQUXXNjoXZSszs9QCfbbpKT0/Mh4PhfS6rRbm NNQC1zS8An2x1PLHPS6649DRkiYOMWTXzAlSE Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 X-Spamd-Bar: + List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Am Mittwoch, dem 02.04.2025 um 22:41 +0300 schrieb Heikki Linnakangas: > * The stuff to save the FmgrInfo for gbt_enum_sortsupport() was > broken.=20 > It saved the address of FmgrInfo struct that was allocated in a local > variable, on the stack, in SortSupport->ssup-extra, and expected it > to=20 > be valid on subsequent call to gbt_enum_ssup_cmp(). It went unnoticed > because enum_cmp() only accesses the FmgrInfo struct if it encounters > odd enum values, i.e. enum values that have been added with ALTER > TYPE=20 > ADD VALUE. I fixed that, and modified the existing enum test to cover > that case. >=20 Ugh, i obviously didn't pay enough attention here.=20 > * The gist_bpchar_ops opfamily was using the built-in=20 > bpchar_sortsupport() function directly. That's not right, you need to > have a shim that extracts and comparse just the 'lower' value, just > like=20 > for all other datatypes. I think that was just a simple oversight, > but=20 > it happened to pass the tests because bpchar_sortsupport() would not=20 > outright crash, even though we were passing it garbage. It's > interesting=20 > that because the gist sortsupport function is used just to order the=20 > input during build, everything still works if it sorts the input to a > completely bogus ordering, it just gets slower. At one point while=20 > fixing that, I also accidentally used "btcharcmp" instead of=20 > "bpcharcmp", and all the tests passed with that too. >=20 Yes, i missed that. Originally the code did this all over the place with many other types, too. I seem to have overseen this somehow. > Those are now fixed. I also harmonized the comments to use the same=20 > phrasing for all the datatypes, marked all the sortsupport functions > as=20 > PARALLEL SAFE, and reformatted slightly. Note that the original coding was by Christoph Heiss and i picked up his work and rewrote/fixed especially the part with the direct use of sortsupport functions and many other issues spotted by testing and by Andrey. Many thanks for picking this up. There are users out there which are going to be very happy with this if no further issues arise. :)