X.50x OID representation

From: "redhog" <redhog(at)redhog(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: X.50x OID representation
Date: 2006-11-07 11:57:43
Message-ID: 1162900663.458206.82470@h48g2000cwc.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I need to save something very similar to X.50x IOD:s, that is, paths
where the path-components are numbers. For example: 10.5.5003.24.35.

Futhermore, I need to sort these in numerical path order, so that if
two paths are compared according to the first path component that
differs, and this path component is compared numerically, so that e.g.
100 is considered greater than 1.

Is there a suitable datatype in PostgreSQL, or some other way to
achieve this? Storing the paths as strings would make path-components
of different length compare wrongly, e.g. "91" would be considered
greater than "900", since the second digit 1 is greater than the second
digit 0.

One possibility is to store the paths as strings but with the digits
within each path component reversed, so that e.g. 4711 becomes 1174.
This would work, given that the path-separator compares less than all
digits, but is rather uggly and requires a bit of nasty rewriting when
updating/inserting/reading rows.

Any ideas?

Thanks in advance,
Egil

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-11-07 12:06:34 Re: X.50x OID representation
Previous Message William Leite Araújo 2006-11-07 10:29:07 Re: FOR ... IN