From: | "Richard Huxton" <dev(at)archonet(dot)com> |
---|---|
To: | "Frank Miles" <fpm(at)u(dot)washington(dot)edu>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: LIKE erratic? or unseen DB corruption? |
Date: | 2001-05-21 16:28:39 |
Message-ID: | 004401c0e213$18e09000$1001a8c0@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
From: "Frank Miles" <fpm(at)u(dot)washington(dot)edu>
> A direct query gets appropriate rows of data:
>
> dbname=# select * from partdef where shpname = 'IDC16W';
> pn_id | class | num | mt | ver | loc_id | unit_id | subptcnt |
shpname | value | descrip
> -------+-------+------+----+-----+--------+---------+----------+----------
--------+------------+---------
> 17 | 328 | 08X2 | 0 | 0 | | | 1 | IDC16W
| Header-8x2 |
> 11 | 323 | 08X2 | 0 | 0 | | | 1 | IDC16W
| Header-8x2 |
>
> ...while the very same query (substituting LIKE for the '=' sign) gets
nothing!?
>
Is "shpname" char() rather than varchar() or text? If so I think = strips
spaces from the end and LIKE doesn't.
Try a LIKE 'IDC16W%' and see if that works, or try padding the match with
spaces. Then, I'd recommend replacing any char() with varchar() - not
noticably slower (IMHO) and a lot less irritating.
- Richard Huxton
From | Date | Subject | |
---|---|---|---|
Next Message | Patrick Welche | 2001-05-21 16:32:25 | Memory usage and pg_dump |
Previous Message | Andrew Rawnsley | 2001-05-21 16:26:11 | Re: Queries across multiple databases (was: SELECT from a table in another database). |