Re: using position in where

Поиск
Список
Период
Сортировка
От John DeSoi
Тема Re: using position in where
Дата
Msg-id 2B8A7A9C-EDBA-4BD6-9C3C-70E55F7970A2@pgedit.com
обсуждение исходный текст
Ответ на using position in where  ("Lynn Manhart" <ManhartL@mstarmetro.net>)
Список pgsql-novice
On Nov 12, 2009, at 7:29 PM, Lynn Manhart wrote:

> select * in customers where position ('sub_string' in 'text_column')
> > 0;

If you really have single quotes around the name of your text column,
position is looking for your string in that literal text. It should
not have single quotes. If your column name is a reserved word or has
special characters you can double quote it.

I also think you want select * "FROM" not "IN", so

SELECT * FROM customers WHERE position('sub_string' in
customers_text_column) > 0;

> Another question - how are upper and lower case handled when using
> "order by"? In my experimenting, it seems to be doing a case
> insensitive compare, but the docs I've read seem to indicate
> otherwise.

It depends on the locale settings when the cluster was created. On US
systems, typically uppercase precedes lowercase. E.g. "Zip" is before
"apple" in an ascending sort.



John DeSoi, Ph.D.





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

Предыдущее
От: "Lynn Manhart"
Дата:
Сообщение: using position in where
Следующее
От: Jasen Betts
Дата:
Сообщение: Re: using position in where