Re: LIKE erratic? or unseen DB corruption?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: LIKE erratic? or unseen DB corruption?
Дата
Msg-id 004401c0e213$18e09000$1001a8c0@archonet.com
обсуждение исходный текст
Ответ на LIKE erratic? or unseen DB corruption?  (Frank Miles <fpm@u.washington.edu>)
Список pgsql-general
From: "Frank Miles" <fpm@u.washington.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


В списке pgsql-general по дате отправления:

Предыдущее
От: "Gregory Wood"
Дата:
Сообщение: Re: LIKE erratic? or unseen DB corruption?
Следующее
От: "Richard Huxton"
Дата:
Сообщение: Re: psql shell problem