On Wed, 19 Jan 2005 17:37:20 -0500, Rick Schumeyer <rschumeyer@xxxxxxxx> 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@xxxxxxxxx GPLS -- PINES Development Database Developer http://open-ils.org ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings