Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-23 Thread Peter Geoghegan
On Mon, Oct 16, 2023 at 11:21 PM Donghang Lin wrote: > It seems to me that as long as a data type has a deterministic sort but not > necessarily be equalimage, > it should be able to support deduplication. e.g for interval type, we add a > byte wise tie breaker > after '24h' and '1day' are comp

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-23 Thread Noah Misch
On Mon, Oct 16, 2023 at 11:21:20PM -0700, Donghang Lin wrote: > > I've also caught btree posting lists where one TID refers to a '1d' heap > > tuple, while another TID refers to a '24h' heap tuple. amcheck complains. > Index-only scans can return the '1d' bits where the actual tuple had the > '24h

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-16 Thread Donghang Lin
> I've also caught btree posting lists where one TID refers to a '1d' heap > tuple, while another TID refers to a '24h' heap tuple. amcheck complains. Index-only scans can return the '1d' bits where the actual tuple had the '24h' bits. Have a build without the patch. I can't reproduce amcheck com

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-12 Thread Peter Geoghegan
On Thu, Oct 12, 2023 at 4:10 PM Noah Misch wrote: > > exactly one case like that post-fix (interval_ops is at least the only > > affected core code opfamily), so why not point that out directly with > > a HINT? A HINT could go a long way towards putting the problem in > > context, without really a

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-12 Thread Noah Misch
On Wed, Oct 11, 2023 at 01:00:44PM -0700, Peter Geoghegan wrote: > On Wed, Oct 11, 2023 at 11:38 AM Noah Misch wrote: > > Interesting. So, >99% of interval-type indexes, even ones WITH > > (deduplicate_items=off), will get amcheck failures. The <1% of exceptions > > might include indexes having

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-11 Thread Peter Geoghegan
On Wed, Oct 11, 2023 at 11:38 AM Noah Misch wrote: > Interesting. So, >99% of interval-type indexes, even ones WITH > (deduplicate_items=off), will get amcheck failures. The <1% of exceptions > might include indexes having allequalimage=off due to an additional column, > e.g. a two-column (inter

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-11 Thread Noah Misch
On Tue, Oct 10, 2023 at 09:35:45PM -0700, Peter Geoghegan wrote: > On Tue, Oct 10, 2023 at 8:51 PM Peter Geoghegan wrote: > > I don't see any reason to delay committing your fix. The issue that > > you've highlighted is exactly the kind of issue that I anticipated > > might happen at some point. T

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-10 Thread Peter Geoghegan
On Tue, Oct 10, 2023 at 8:51 PM Peter Geoghegan wrote: > I don't see any reason to delay committing your fix. The issue that > you've highlighted is exactly the kind of issue that I anticipated > might happen at some point. This seems straightforward. BTW, we don't need to recommend the heapallin

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-10 Thread Peter Geoghegan
On Tue, Oct 10, 2023 at 8:29 PM Noah Misch wrote: > My friend got an amcheck "lacks matching index tuple" failure, and they asked > me about it. I ran into the assertion failure while reproducing things. Reminds me of the time that amcheck found a bug in the default btree opclass for PostGIS's g

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-10 Thread Noah Misch
On Tue, Oct 10, 2023 at 08:12:36PM -0700, Peter Geoghegan wrote: > On Tue, Oct 10, 2023 at 6:33 PM Noah Misch wrote: > > interval_ops, however, recognizes equal-but-distinguishable values: > > > Fails with: > > > > 2498151 2023-10-10 05:06:46.177 GMT DEBUG: building index "ti" on table > > "t

Re: interval_ops shall stop using btequalimage (deduplication)

2023-10-10 Thread Peter Geoghegan
On Tue, Oct 10, 2023 at 6:33 PM Noah Misch wrote: > interval_ops, however, recognizes equal-but-distinguishable values: > Fails with: > > 2498151 2023-10-10 05:06:46.177 GMT DEBUG: building index "ti" on table > "t" serially > 2498151 2023-10-10 05:06:46.178 GMT DEBUG: index "ti" can safel

interval_ops shall stop using btequalimage (deduplication)

2023-10-10 Thread Noah Misch
The btequalimage() header comment says: * Generic "equalimage" support function. * * B-Tree operator classes whose equality function could safely be replaced by * datum_image_eq() in all cases can use this as their "equalimage" support * function. interval_ops, however, recognizes equal-but-