Re: select statement sorting

From: Richard Huxton <dev(at)archonet(dot)com>
To: Alexander Cohen <alex(at)toomuchspace(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: select statement sorting
Date: 2004-03-31 17:04:08
Message-ID: 200403311804.09143.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday 31 March 2004 16:31, 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?

SELECT first_name FROM foo ORDER BY lower(first_name)

Of course, then you can't guarantee whether you get "Alex" then "alex" or the
other way around, so you might want:

SELECT first_name FROM foo ORDER BY lower(first_name), first_name

> 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?

You need to quote the names to create them this way. If you do so, you need to
quote them when you use them, so:

CREATE MyTable / SELECT FROM mytable/MYTABLE/MyTaBle...
CREATE "MyTable" / SELECT FROM "MyTable"

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Diogo Biazus 2004-03-31 17:19:06 Re: Wich hardware suits best for large full-text indexed
Previous Message Diogo Biazus 2004-03-31 17:03:45 Re: Wich hardware suits best for large full-text indexed