| От | Ilja Golshtein |
|---|---|
| Тема | CHAR LIKE VARCHAR |
| Дата | |
| Msg-id | 42A559B9.000001.28500@mfront7.yandex.ru обсуждение |
| Ответы |
Re: CHAR LIKE VARCHAR
|
| Список | pgsql-general |
Hi!
I came across following difference
between "LIKE" and "=" regarding
CHARs and VARCHARs
create table aa(f5 char(5), fv varchar(5));
insert into aa values('str1', 'str1');
select count(*) from aa where f5 = fv;
> 1
select count(*) from aa where f5 like fv;
> 0
I understand trailing spaces in CHAR are not
significant though I expect DBMS shows
consistent (and, ideally, clearly documented)
behavior.
From my point of view in example above
it would be nice to have the same result
for both queries regardless it is 0 or 1.
Of course, I may be wrong. Is there a clear
concept behind the difference between "LIKE"
and "="?
Thanks.
--
Best regards
Ilja Golshtein
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера