Re: Custom sort - Mailing list pgsql-general

From Craig Ringer
Subject Re: Custom sort
Date
Msg-id 48A4E2E1.8010402@postnewspapers.com.au
Whole thread Raw
In response to Custom sort  (Artacus <artacus@comcast.net>)
List pgsql-general
Artacus wrote:
> Can you define a custom sort in postgres? For instance in mysql, you
> could do something like (I forget the exact syntax)
>
> ORDER BY FIND_IN_SET(column_name, ('one','two','three'))

The simplest direct mapping would probably be a CASE statement (see the
PostgreSQL documentation). As others have noted, enums and Pl/PgSQL
functions are also options.

--
Craig Ringer

pgsql-general by date:

Previous
From: Hui Xie
Date:
Subject: Re: Query help
Next
From: Andrew Sullivan
Date:
Subject: Re: [Q] DNS(bind) ER model