Re: BYTEA, indexes and "like" - Mailing list pgsql-general

From Tom Lane
Subject Re: BYTEA, indexes and "like"
Date
Msg-id 8548.1029707306@sss.pgh.pa.us
Whole thread Raw
In response to BYTEA, indexes and "like"  (Alvar Freude <alvar@a-blast.org>)
List pgsql-general
Alvar Freude <alvar@a-blast.org> writes:
> it seems, that a BYTEA fiels doesn't support indexes in WHERE-Statement
> with a "like" condition:

I was somewhat bemused to discover that we even *have* a LIKE for bytea.
It does not seem to work real well:

regression=# create table foo (f1 bytea);
CREATE TABLE
regression=# select * from foo where f1 like 'z';
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

The server log shows
TRAP: FailedAssertion("!(((Const *) other)->consttype == 25)", File: "selfuncs.c", Line: 857)
LOG:  server process (pid 8487) was terminated by signal 6

which traces down to the fact that patternsel() expects to see only TEXT
patterns.  Joe, was it you that put this stuff in?  If so, shame on you
for not using --enable-cassert when doing backend work.

            regards, tom lane

pgsql-general by date:

Previous
From: GB Clark
Date:
Subject: Re: Triggers - with a little change
Next
From: Joe Conway
Date:
Subject: Re: BYTEA, indexes and "like"