Natural sort order extension.

Started by Dmitriy Igrishinabout 6 years ago3 messagesgeneral
Jump to latest
#1Dmitriy Igrishin
dmitigr@gmail.com

Hi,

I've implemented a PostgreSQL extension for natural sort order. I.e.
strings like "z20", "z0004", "z11", "z2" sorted in ascending order as
"z2", "z0004", "z11", "z20".

Currently it implements the type textnso which is binary-coercible
to/from the text type. It's possible to declare table columns of type
textnso and create indexes on them.

Details are here https://github.com/dmitigr/pgnso

Any feedback are welcome!

Thanks.

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Dmitriy Igrishin (#1)
Re: Natural sort order extension.

On Wed, 2020-02-12 at 18:45 +0300, Dmitry Igrishin wrote:

I've implemented a PostgreSQL extension for natural sort order. I.e.
strings like "z20", "z0004", "z11", "z2" sorted in ascending order as
"z2", "z0004", "z11", "z20".

Currently it implements the type textnso which is binary-coercible
to/from the text type. It's possible to declare table columns of type
textnso and create indexes on them.

Details are here https://github.com/dmitigr/pgnso

Any feedback are welcome!

I don't want to detract from this, but from PostgreSQL v10 on you can use
ICU collations with the "kn-true" variant to have natural sort order.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

#3Dmitriy Igrishin
dmitigr@gmail.com
In reply to: Laurenz Albe (#2)
Re: Natural sort order extension.

On Wed, 12 Feb 2020, 19:55 Laurenz Albe, <laurenz.albe@cybertec.at> wrote:

On Wed, 2020-02-12 at 18:45 +0300, Dmitry Igrishin wrote:

I've implemented a PostgreSQL extension for natural sort order. I.e.
strings like "z20", "z0004", "z11", "z2" sorted in ascending order as
"z2", "z0004", "z11", "z20".

Currently it implements the type textnso which is binary-coercible
to/from the text type. It's possible to declare table columns of type
textnso and create indexes on them.

Details are here https://github.com/dmitigr/pgnso

Any feedback are welcome!

I don't want to detract from this, but from PostgreSQL v10 on you can use
ICU collations with the "kn-true" variant to have natural sort order.

Thanks for the point. But my extension works with default collation and
UTF-8 encoding. And ICU is not required.

Show quoted text