Clean up parsing of ltree and lquery some more.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 1 Apr 2020 23:44:17 +0000 (19:44 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 1 Apr 2020 23:44:17 +0000 (19:44 -0400)
commit17ca067995114ee40749d9138ba85fdd68518052
treeabd14466afb82661d59a41c633c3de3790109881
parent949a9f043eb70a4986041b47513579f9a13d6a33
Clean up parsing of ltree and lquery some more.

Fix lquery parsing to handle repeated flag characters correctly,
and to enforce the max label length correctly in some cases where
it did not before, and to detect empty labels in some cases where
it did not before.

In a more cosmetic vein, use a switch rather than if-then chains to
handle the different states, and avoid unnecessary checks on charlen
when looking for ASCII characters, and factor out multiple copies of
the label length checking code.

Tom Lane and Dmitry Belyavsky

Discussion: https://postgr.es/m/CADqLbzLVkBuPX0812o+z=c3i6honszsZZ6VQOSKR3VPbB56P3w@mail.gmail.com
contrib/ltree/expected/ltree.out
contrib/ltree/ltree_io.c
contrib/ltree/sql/ltree.sql