Re: sorting library of congress numbers - Mailing list pgsql-general

From Mike Rylander
Subject Re: sorting library of congress numbers
Date
Msg-id b918cf3d0501191509631db880@mail.gmail.com
Whole thread Raw
In response to sorting library of congress numbers  ("Rick Schumeyer" <rschumeyer@ieee.org>)
Responses Re: sorting library of congress numbers
List pgsql-general
On Wed, 19 Jan 2005 17:37:20 -0500, Rick Schumeyer <rschumeyer@ieee.org> wrote:
>
> I have a table where one of the columns is a library of congress number.
>
> I would like to be able to ORDER BY this column.
>

First off, by LOC numbers do you mean Title Control Numbers like
"o00325992" or "i0824506030" with an optional vendor name in front of
them?

>
>
> Currently, the column is a varchar.  Unfortunately, a normal string
> comparison will not work.
>
>
> First, has anyone done this already?
>

If you mean ISBN or ISSN numbers then there is a contrib module that
may help, though I don't think it implements a new type, just
functions to validate and generate them.

>
> If not, I'm thinking I would need to:
>
> 1)       define a new type to hold LOC numbers.
>
> 2)       write a function that determines less than, greater than
>
>
>
> It seems like I'm missing something here.  I have not yet defined a new type…is defining less/greater part of that
process?
> Is there a simpler way to do this?

You could probably just write some comparison functions, create a new
operator class, and assign them names like "~>" and "~<".  See the
documentation here:
http://www.postgresql.org/docs/8.0/interactive/xoper.html .

--
Mike Rylander
mrylander@gmail.com
GPLS -- PINES Development
Database Developer
http://open-ils.org

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Multiline plpython procedure
Next
From: "Rick Schumeyer"
Date:
Subject: Re: sorting library of congress numbers