Search Postgresql Archives

X.50x OID representation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux