Allowing dash character in LTREE

Started by Cyril Auburtinover 8 years ago6 messages
#1Cyril Auburtin
cyril.auburtin@gmail.com

It could be useful to allow the `-` char in allowed LTREE label
characters (currently
a-zA-Z0-9_ https://www.postgresql.org/docs/9.6/static/ltree.html)

The reason is to allow to use more easily base64 ids, (like
https://github.com/dylang/shortid, ...), uuid's too in labels

`-` is also not used as a query operator as a plus

source: https://doxygen.postgresql.org/ltree_8h.html#
a1cb5d5dd0c364d720854e8a250967dd1

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Cyril Auburtin (#1)
Re: Allowing dash character in LTREE

On Sat, May 20, 2017 at 1:27 AM, Cyril Auburtin <cyril.auburtin@gmail.com>
wrote:

It could be useful to allow the `-` char in allowed LTREE label characters (currently
a-zA-Z0-9_ https://www.postgresql.org/docs/9.6/static/ltree.html)

The reason is to allow to use more easily base64 ids, (like
https://github.com/dylang/shortid, ...), uuid's too in labels

`-` is also not used as a query operator as a plus

source: https://doxygen.postgresql.org/ltree_8h.html#a
1cb5d5dd0c364d720854e8a250967dd1

​This is the third time you've posted this suggestion. Its been seen by
the people you are sending it to.

I don't follow how this helps for UUID - they are not usually generated
hierarchically​...

I'll +1 the thought, but I won't be providing a patch.

David J.

#3Cyril Auburtin
cyril.auburtin@gmail.com
In reply to: David G. Johnston (#2)
Re: Allowing dash character in LTREE

Ah sorry, first time, I thought it didn't pass

It's to support multiple ids (base64 ones are frequent) (or uuid's) in a
path. I think it's more practical than an array, for searching and sorting

But I understand that LTREE's main purpose is probably more for words
'breadcrumbs' etc..

2017-05-20 18:31 GMT+02:00 David G. Johnston <david.g.johnston@gmail.com>:

Show quoted text

On Sat, May 20, 2017 at 1:27 AM, Cyril Auburtin <cyril.auburtin@gmail.com>
wrote:

It could be useful to allow the `-` char in allowed LTREE label
characters (currently a-zA-Z0-9_ https://www.postgre
sql.org/docs/9.6/static/ltree.html)

The reason is to allow to use more easily base64 ids, (like
https://github.com/dylang/shortid, ...), uuid's too in labels

`-` is also not used as a query operator as a plus

source: https://doxygen.postgresql.org/ltree_8h.html#a1cb5d5
dd0c364d720854e8a250967dd1

​This is the third time you've posted this suggestion. Its been seen by
the people you are sending it to.

I don't follow how this helps for UUID - they are not usually generated
hierarchically​...

I'll +1 the thought, but I won't be providing a patch.

David J.

#4David G. Johnston
david.g.johnston@gmail.com
In reply to: Cyril Auburtin (#3)
Re: Allowing dash character in LTREE

On Sat, May 20, 2017 at 11:26 AM, Cyril Auburtin <cyril.auburtin@gmail.com>
wrote:

Ah sorry, first time, I thought it didn't pass

​You should check our excellent online mailing list archives before
re-sending.

https://www.postgresql.org/list/

David J.

#5Manuel Kniep
rapimo@adeven.com
In reply to: Cyril Auburtin (#1)
Re: Allowing dash character in LTREE

Manuel Kniep
Danziger Str. 116
10405 Berlin

Am 20.05.2017 um 10:27 schrieb Cyril Auburtin <cyril.auburtin@gmail.com>:

It could be useful to allow the `-` char in allowed LTREE label characters (currently a-zA-Z0-9_ https://https://github.com/adjust/ltreewww.postgresql.org/docs/9.6/static/ltree.html)

There is a patched version here
https://github.com/adjust/ltree

Which allows almost any char but uses '::' as label separator my it's an inspiration to do your own patch.

Manuel

#6Cyril Auburtin
cyril.auburtin@gmail.com
In reply to: Manuel Kniep (#5)
Re: Allowing dash character in LTREE

interesting, but I like '.' as path separator, it's url-friendly, and easy

I used some simple `path TEXT CHECK (path ~ '^[\w.-]+$')` but now I
regret it, because it's not as easy to index and optimize requests

2017-05-21 11:28 GMT+02:00 Manuel Kniep <rapimo@adeven.com>:

Show quoted text

Manuel Kniep
Danziger Str. 116
10405 Berlin
Am 20.05.2017 um 10:27 schrieb Cyril Auburtin <cyril.auburtin@gmail.com>:

It could be useful to allow the `-` char in allowed LTREE label characters (currently
a-zA-Z0-9_ https://
<https://www.postgresql.org/docs/9.6/static/ltree.html&gt;https://
github.com/adjust/ltreewww.postgresql.org/docs/9.6/static/ltree.html)

There is a patched version here
https://github.com/adjust/ltree

Which allows almost any char but uses '::' as label separator my it's an
inspiration to do your own patch.

Manuel