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.96) (envelope-from ) id 1wVuyF-002H4n-05 for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Jun 2026 17:38:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wVuyB-00GKS9-26 for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Jun 2026 17:38:03 +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.96) (envelope-from ) id 1wVuyB-00GKRz-0Z for pgsql-hackers@lists.postgresql.org; Sat, 06 Jun 2026 17:38:03 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wVuy8-00000001ceE-1t1o for pgsql-hackers@postgresql.org; Sat, 06 Jun 2026 17:38:02 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-490bb83a3f6so24285575e9.0 for ; Sat, 06 Jun 2026 10:37:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780767479; x=1781372279; darn=postgresql.org; h=mime-version:subject:references:in-reply-to:message-id:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=z1N0cmQ5xd/vmxAGfhxFldS/3OpAyvDW6E6DGHm+olU=; b=ctzNITFdaGzQFmxAKhz6t90lKcj3Izv2IHokflVs87VvFR5yC38w3PttefJ5yBXidf +Hn+1a+rtg+as0fA/zKTJDQcNHPxB2BKcIVi1kLVHszKdu9L+lWk8bGY3qKVMJA1PLgD XIOgdG4VpouZ0i5zhVV2qozYZ42zYY48sM0xXH4DaDIPYZeAQeJaMcaOtOe6g6+Wy9Ot zAIZuf03C9r0oykvi65IQSoYkYaU9DNh9NkfmcnZFl9NcG7Ts/TldT4ssUvIDfJWX+Zw YFloWa2qEyBNzpiioWbwCPGtaKMpgYhwQooUwzsXA34R5S6K9/AQY69jVXjiHD5GRpsi 3pog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780767479; x=1781372279; h=mime-version:subject:references:in-reply-to:message-id:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=z1N0cmQ5xd/vmxAGfhxFldS/3OpAyvDW6E6DGHm+olU=; b=pKna105SeOxLdAJAFou7CDwtPnUgGozD8HW2ufNXJ2kIDzxaZ4Z0vFnd13l0IF4NGo 77lFt/+ogsF6T18gK5Ghym+hTRJrmuCEdbxT69VJJJuTTmfqS6z+eg1UGWbtdyO1fv3j 7+mzcjGryxDYlKkivsB4IztkLdLVI1W/fa3Uss9vZykev412du26HcW/6dN2qUmP36u3 3BV9PqOEOyskEZKeKfB0W+ps4ecB7aHXlYSwdyV3NnvXLE4m5ObNKuIMzbpk0k/jvPcb 1YtgPHb+Ge2G+FzSmTIYwABel3u3v4FJx61FqGuC48uvMn3ZqbS5rABvXGxw7Yo8pGCK Ubmw== X-Gm-Message-State: AOJu0Yy0oCurFTQqQFRs9pE8OlWHXAokrL40yWgyJ7pvyu9vFi5tKIdT /Cfn8jqi+kCZ6x4aNncL3E/3jI2RgN9GviVTtgFqO41jOyX4Ow1wnVKp X-Gm-Gg: Acq92OFOEgyScZQM3MXSuCYF+065LDamkkQUUfFu0OnwDc2pbYKJ/e0Uh76l6r/3pWi yXPg/4dOTm6knpVEkjZeEVYYcE45qXUq/L7OPRBioAzc62mgmQsWLiN3nfTvBSQ07kQd7fPH9+I gjld+4FKzs6FLpX4lYl5v1UUChQ0D2H7LZtuwTWgmCBqHYOuIkFC8QRNDhMChdnLbzN5phVmVsb hEai/Mm3cIJN8hLgX1uNZUotQ1XyhJE4qeYcxElhle69GGLEIBc3DuaB0kLfoUFWC8T7l2zgVIR FVA11XXscL3qXZKC6eD5LEhvllAfiDscC9/nniZo440EKrDWlGAd+/BOQMwOKEu45aZcuxlolCr VtTdtvchNu8oRFQ2wk+H+oHQM9g6iAGHP4YA7CINbELOmdN2l6G0yxmvNCKB3V2A9vsgRSIthUi hfRCcHTfKU0ACPRb3W4XnPwKl3iWhUeojVQ+Lz/w5l1idXak17mJY2paC1LIuh X-Received: by 2002:a05:600c:3515:b0:490:48b7:c1ff with SMTP id 5b1f17b1804b1-490c26057abmr148248745e9.17.1780767478566; Sat, 06 Jun 2026 10:37:58 -0700 (PDT) Received: from [192.168.1.235] ([109.227.133.120]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f351d69sm63459196f8f.29.2026.06.06.10.37.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Jun 2026 10:37:57 -0700 (PDT) Date: Sat, 6 Jun 2026 19:37:51 +0200 From: Alexander Nestorov To: Andrey Borodin Cc: pgsql-hackers mailing list Message-ID: <18e88767-6c31-402a-887e-37c38b366a6a@Spark> In-Reply-To: <4B4B0998-7B43-4893-9603-0AF212036690@yandex-team.ru> References: <36b4f67d-5975-452c-a6b8-b6407f0924ee@Spark> <4B4B0998-7B43-4893-9603-0AF212036690@yandex-team.ru> Subject: Re: [PATCH] btree_gist: add cross-type integer operator support for GiST X-Readdle-Message-ID: 18e88767-6c31-402a-887e-37c38b366a6a@Spark MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="6a245af4_41b71efb_76fe" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --6a245af4_41b71efb_76fe Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hey Andrey=21 I'm happy to hear you like the proposal=21 Let me reply in order: 1) Oh, good catch=21 Since the other points require some changes in the patc= h, I'll first do them and then I'll make sure to create a benchmark and post the results. 2) Agreed, that's a fair point. I was speculating with a generalized =22foun= dation=22 because I thought I'd get questions about how I'd support other types if = I went with a simpler patch that covered only ints. Let me rework that and send a new patch=21 3) I was also worried about this. I wrote some checks against a hardcoded li= st in the int=5Fcrosstype.sql (which I didn't submit, you noticed), but that is= not checking anything besides the SQL part. I checked amvalidate(), but I couldn't find a way to check if there are inconsistencies between what is defined in C and what is defined in SQL. That function only checks amproc/amop signatures and I wasn't able to see= how it could compare against the C dispatch. There is a comment in opclasscmds.c, around line 400, that already hints = about it not being able to run such validation. > we have no way to validate that the offered set of operators and > functions are consistent with the AM's expectations.=C2=A0=C2=A0It woul= d be > nice to provide such a check someday I could create a new core hook, but maybe that would be a larger change t= hat will expand the scope of this patch, and since neither CREATE nor ALTER A= DD calls it, the hook would still need a test to fire it. As an alternative, maybe I could use the regression suite=3F I can put th= e knowledge of supported dispatch entries in the code, expose it as a valid= ator and assert it in the tests. Running =22make check=22 would assert that th= ese entries agree with pg=5Famop in both directions. Concretely: the integer consistent/distance functions would dispatch thro= ugh a small static table of supported subtype OIDs. A set-returning C function = would expose that same table to SQL, and a regression test would EXCEPT it agai= nst the cross-type rows in pg=5Famop for gist=5Fint=7B2,4,8=7D=5Fops in both dire= ctions. Adding an amop without a matching dispatch entry (or vice versa) would show up as a= diff under make check. Would you prefer the regression suite approach=3F Or do you think it migh= t be a better idea to find a way to do it with amvalidate()=3F 4) All right, I'll make sure to add it to the next patch. To sum up, agreeing on 3) means I'd be ready for working on the next vers= ion of the patch. I just need your advice on that bit. I was not aware of the existence of commitfest, let me register :) Thank you very much Andrey, best regards=21 --6a245af4_41b71efb_76fe Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hey Andrey=21

I'm happy to hear you like the proposal=21
Let me reply in order:

1)

Oh, good catch=21 Since the other points require some changes in the patc= h, I'll
first do them and then I'll make sure to create a benchmark and post the<= br /> results.

2)

Agreed, that's a fair point. I was speculating with a generalized =22foun= dation=22
because I thought I'd get questions about how I'd support other types if = I went
with a simpler patch that covered only ints.

Let me rework that and send a new patch=21

3)

I was also worried about this. I wrote some checks against a hardcoded li= st in
the int=5Fcrosstype.sql (which I didn't submit, you noticed), but that is= not
checking anything besides the SQL part.

I checked amvalidate(), but I couldn't find a way to check if there are inconsistencies between what is defined in C and what is defined in SQL.<= br /> That function only checks amproc/amop signatures and I wasn't able to see= how it
could compare against the C dispatch.
There is a comment in opclasscmds.c, around line 400, that already hints = about
it not being able to run such validation.

> we have no way to validate that the offered set of operators and
> functions are consistent with the AM's expectations.&=23160;&=23160;= It would be
> nice to provide such a check someday

I could create a new core hook, but maybe that would be a larger change t= hat
will expand the scope of this patch, and since neither CREATE nor ALTER A= DD
calls it, the hook would still need a test to fire it.

As an alternative, maybe I could use the regression suite=3F I can put th= e
knowledge of supported dispatch entries in the code, expose it as a valid= ator
and assert it in the tests. Running =22make check=22 would assert that th= ese entries
agree with pg=5Famop in both directions.

Concretely: the integer consistent/distance functions would dispatch thro= ugh a
small static table of supported subtype OIDs. A set-returning C function = would
expose that same table to SQL, and a regression test would EXCEPT it agai= nst the
cross-type rows in pg=5Famop for gist=5Fint=7B2,4,8=7D=5Fops in both dire= ctions. Adding an
amop without a matching dispatch entry (or vice versa) would show up as a= diff
under make check.

Would you prefer the regression suite approach=3F Or do you think it migh= t be
a better idea to find a way to do it with amvalidate()=3F

4)

All right, I'll make sure to add it to the next patch.

To sum up, agreeing on 3) means I'd be ready for working on the next vers= ion of
the patch. I just need your advice on that bit.

I was not aware of the existence of commitfest, let me register :)

Thank you very much Andrey, best regards=21
--6a245af4_41b71efb_76fe--