| От | Tom Lane |
|---|---|
| Тема | Re: Ordering by field using lower() |
| Дата | |
| Msg-id | 26143.1003036587@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Ordering by field using lower() (speedboy <speedboy@nomicrosoft.org>) |
| Список | pgsql-sql |
speedboy <speedboy@nomicrosoft.org> writes:
> Hi, please view the output from some queries below. My question is, why is
> the ordering apparently wrong when using the lower() function?
You're getting a textual sort, not a numeric sort.
> The field "pid" is of type int2 and there is no need to use lower(), but I
> will need to put a test clause in php if my order type is pid so I do not
> use lower() in the query.
That would be a good plan anyway. It's pure luck for you that there is
an implicit int2->text coercion path that allows the text function
lower() to be applied to an int2 field. If your app expects to be able
to apply lower() to any datatype at all, I'd say your app is broken.
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера