Re: select statement sorting - Mailing list pgsql-general

From Richard Huxton
Subject Re: select statement sorting
Date
Msg-id 200403311804.09143.dev@archonet.com
Whole thread Raw
In response to select statement sorting  (Alexander Cohen <alex@toomuchspace.com>)
Responses select distinct w/order by
List 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

pgsql-general by date:

Previous
From: Diogo Biazus
Date:
Subject: Re: Wich hardware suits best for large full-text indexed
Next
From: Diogo Biazus
Date:
Subject: Re: Wich hardware suits best for large full-text indexed