Re: Zero-length character breaking query? - Mailing list pgsql-general

From Tom Lane
Subject Re: Zero-length character breaking query?
Date
Msg-id 6983.1331904769@sss.pgh.pa.us
Whole thread Raw
In response to Zero-length character breaking query?  (Doug Gorley <dgorley@aihs.ca>)
Responses Re: Zero-length character breaking query?
List pgsql-general
Doug Gorley <dgorley@aihs.ca> writes:
> The table is called tdt_unsent.  The field is str_name_l.  For demonstration purposes,  the value is "SMITH".

> "select * from tdt_unsent where str_name_l = 'SMITH'" returns 0 rows.
> "select * from tdt_unsent where str_name_l ~ '^SMITH'" returns 3 rows.
> "select * from tdt_unsent where str_name_l ~ '^SMITH$'" returns 0 rows.
> "select length(str_name_l) from tdt_unsent where str_name_l ~ '^SMITH'" returns "5".

I'd check EXPLAIN (with the actual problematic string, not SMITH).
The planner is probably trying to build an index range condition from
the regex pattern --- is it doing the right thing given your locale?

If the plan looks okay, maybe you need to reindex whatever index it's
using.

            regards, tom lane

pgsql-general by date:

Previous
From: David Johnston
Date:
Subject: Re: Zero-length character breaking query?
Next
From: Tom Lane
Date:
Subject: Re: Problem for restoure data base Postgre