ltree docs imprecise about sorting order

Started by PG Doc comments formover 1 year ago3 messages
#1PG Doc comments form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/ltree.html
Description:

The ltree docs available at
https://www.postgresql.org/docs/current/ltree.html state "Comparison sorts
in the order of a tree traversal" without specifying the strategy
implemented to walk the tree.
A quick experiment suggests that the implemented solution is pre-ordered
depth-first search.
I suggest the ltree docs be amended to "Comparison sorts in the order of a
pre-ordered depth-first tree traversal".

Best regards,
Pierre Vennin

#2Bruce Momjian
bruce@momjian.us
In reply to: PG Doc comments form (#1)
Re: ltree docs imprecise about sorting order

On Thu, May 23, 2024 at 04:17:50PM +0000, PG Doc comments form wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/ltree.html
Description:

The ltree docs available at
https://www.postgresql.org/docs/current/ltree.html state "Comparison sorts
in the order of a tree traversal" without specifying the strategy
implemented to walk the tree.
A quick experiment suggests that the implemented solution is pre-ordered
depth-first search.
I suggest the ltree docs be amended to "Comparison sorts in the order of a
pre-ordered depth-first tree traversal".

[ moved to hackers ]

Can someone confirm this and/or create a patch?

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com

When a patient asks the doctor, "Am I going to die?", he means
"Am I going to die soon?"

#3David G. Johnston
david.g.johnston@gmail.com
In reply to: Bruce Momjian (#2)
Re: ltree docs imprecise about sorting order

On Wednesday, October 16, 2024, Bruce Momjian <bruce@momjian.us> wrote:

On Thu, May 23, 2024 at 04:17:50PM +0000, PG Doc comments form wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/ltree.html
Description:

The ltree docs available at
https://www.postgresql.org/docs/current/ltree.html state "Comparison

sorts

in the order of a tree traversal" without specifying the strategy
implemented to walk the tree.
A quick experiment suggests that the implemented solution is pre-ordered
depth-first search.
I suggest the ltree docs be amended to "Comparison sorts in the order of

a

pre-ordered depth-first tree traversal".

[ moved to hackers ]

Can someone confirm this and/or create a patch?

If we are going to update the description of sorting we should probably
take the chance to mention collation, or I believe the lack thereof.
Including an example with order by wouldn’t hurt either.

The example data is also a perfect tree, all intermediate nodes exist as
their own rows. It may be informative to include exceptions to this rule.

David J.