Re: bytea operator bugs (was Re: [GENERAL] BYTEA, indexes

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvar Freude <alvar(at)a-blast(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: bytea operator bugs (was Re: [GENERAL] BYTEA, indexes
Date: 2002-09-02 00:14:11
Message-ID: 3D72AD53.4080901@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)com> writes:
>>OK. I'll look at both options and make another diff -c proposal ;-) Once
>>that's resolved I'll go back to original issue Alvar raised.
>
> Okay. When you get back to the original issue, the gold is hidden in
> src/backend/optimizer/path/indxpath.c; see the "special indexable
> operators" stuff near the bottom of that file. (It's a bit of a crock
> that this code is hardwired there, and not somehow accessed through a
> system catalog, but it's what we've got at the moment.)

The attached patch re-enables a bytea right hand argument (as compared
to a text right hand argument), and enables index usage, for bytea LIKE
-- e.g.:

parts=# explain select * from bombytea where parent_part like '05-05%';
QUERY PLAN
-------------------------------------------------------------------------------------
Index Scan using bombytea_idx1 on bombytea (cost=0.00..3479.67
rows=1118 width=34)
Index Cond: ((parent_part >= '05-05'::bytea) AND (parent_part <
'05-06'::bytea))
Filter: (parent_part ~~ '05-05%'::bytea)
(3 rows)

Passes all regression tests, and as far as I can tell does not break or
change the behavior of anything else. Please review and apply if there
are no objections (I'd like to see this applied for 7.3, before the
freeze, if possible, but I'll certainly understand if I'm told there's
not enough time left).

Thanks,

Joe

Attachment Content-Type Size
patternsel.3.patch text/plain 38.3 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvar Freude 2002-09-02 00:25:05 Re: bytea operator bugs (was Re: [GENERAL] BYTEA,
Previous Message Bear 2002-09-01 11:50:22 keys

Browse pgsql-patches by date

  From Date Subject
Next Message Alvar Freude 2002-09-02 00:25:05 Re: bytea operator bugs (was Re: [GENERAL] BYTEA,
Previous Message Greg Sabino Mullane 2002-09-01 23:31:02 Re: Properly page footers in psql