Re: Zero-length character breaking query?

From: Doug Gorley <dgorley(at)aihs(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Zero-length character breaking query?
Date: 2012-03-19 01:22:03
Message-ID: 571E120A87CC684288FDD20126E4B4D674DE93CD43@HEXMBVS13.hostedmsx.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Tom; this is at a client site, so I have limited access, but it looks like a REINDEX resolves the issue.

Doug

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: March 16, 2012 6:33 AM
To: Doug Gorley
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Zero-length character breaking query?

Doug Gorley <dgorley(at)aihs(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jayadevan M 2012-03-19 03:39:40 Re: How to isolate the result of SELECT's?
Previous Message Adrian Klaver 2012-03-19 00:21:26 Re: How to isolate the result of SELECT's?