Re: sorting library of congress numbers

From: "Rick Schumeyer" <rschumeyer(at)ieee(dot)org>
To: "'Scott Marlowe'" <smarlowe(at)g2switchworks(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: sorting library of congress numbers
Date: 2005-01-19 23:17:46
Message-ID: 011801c4fe7d$15efca20$0200a8c0@dell8200
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-
> owner(at)postgresql(dot)org] On Behalf Of Scott Marlowe
> Sent: Wednesday, January 19, 2005 5:54 PM
> To: Rick Schumeyer
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] sorting library of congress numbers
>
> On Wed, 2005-01-19 at 16:37, Rick Schumeyer 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.
> >
> >
> >
> > Currently, the column is a varchar. Unfortunately, a normal string
> > comparison
> >
> > will not work.
> >
> >
> >
> > First, has anyone done this already?
> >
> >
> >
> > 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 might want to do something along the lines of storing the PARTs of
> the loc number, then using lpad/rpad in a function to put them together
> in such a way to as to render them orderable. Is there an URL on how
> LOC numbers are ordered?

LOC numbers are described at:

http://library.dts.edu/Pages/RM/Helps/lc_call.shtml

I thought about breaking the pieces up. I will have to think a bit more
about whether that will work.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message vhikida 2005-01-19 23:29:35 Re: Unique Index
Previous Message Mike Rylander 2005-01-19 23:09:50 Re: sorting library of congress numbers