Re: sorting library of congress numbers

From: Mike Rylander <mrylander(at)gmail(dot)com>
To: Rick Schumeyer <rschumeyer(at)ieee(dot)org>, PgSql General <pgsql-general(at)postgresql(dot)org>
Subject: Re: sorting library of congress numbers
Date: 2005-01-19 23:09:50
Message-ID: b918cf3d0501191509631db880@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 19 Jan 2005 17:37:20 -0500, Rick Schumeyer <rschumeyer(at)ieee(dot)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(at)gmail(dot)com
GPLS -- PINES Development
Database Developer
http://open-ils.org

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rick Schumeyer 2005-01-19 23:17:46 Re: sorting library of congress numbers
Previous Message Alvaro Herrera 2005-01-19 23:03:36 Re: Multiline plpython procedure