Re: select statement sorting

From: Steve Atkins <steve(at)blighty(dot)com>
To: Alexander Cohen <alex(at)toomuchspace(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: select statement sorting
Date: 2004-03-31 16:44:48
Message-ID: 20040331164447.GA12609@gp.word-to-the-wise.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Diogo Biazus 2004-03-31 16:45:35 Re: Wich hardware suits best for large full-text indexed
Previous Message Bruno Wolff III 2004-03-31 16:39:42 Re: How can I change type of column