Re: select statement sorting

Поиск
Список
Период
Сортировка
От Steve Atkins
Тема Re: select statement sorting
Дата
Msg-id 20040331164447.GA12609@gp.word-to-the-wise.com
обсуждение исходный текст
Ответ на select statement sorting  (Alexander Cohen <alex@toomuchspace.com>)
Список pgsql-general
On Wed, Mar 31, 2004 at 10:31:43AM -0500, Alexander Cohen wrote:
> is it possible to have postgres return a "SELECT * FROM table ORDER BY
> table_column" query that is not case sensitive order?

> Is this possible or do i need to sort them myself after the query
> returns?

SELECT * FROM table ORDER BY lower(table_column)

will do what you want.

[ If you start using this idiom for larger tables then remember that order
  by lower(something) won't take any advantage of an index on something -
  but may use a functional index on lower(something) ]

> Also, i noticed that postgres will let me create groups, databases and
> users with spaces in their names, is this ok or should i check this
> beforehand and not allow this?

I'd avoid it. It may well be acceptable within postgresql (I see no reason
why it wouldn't be) but I'd bet that it'll confuse or break some third
party tools.

Cheers,
  Steve

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Documentation clairification?, CHECK constraints
Следующее
От: "Karl O. Pinc"
Дата:
Сообщение: Re: How can I change type of column