pgsql: Clean up parsing of ltree and lquery some more.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Clean up parsing of ltree and lquery some more.
Date: 2020-04-01 23:44:29
Message-ID: E1jJn25-0005xW-CP@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/17ca067995114ee40749d9138ba85fdd68518052

Modified Files
--------------
contrib/ltree/expected/ltree.out | 98 ++++++++
contrib/ltree/ltree_io.c | 515 ++++++++++++++++++---------------------
contrib/ltree/sql/ltree.sql | 27 ++
3 files changed, 362 insertions(+), 278 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2020-04-02 00:39:57 pgsql: Collect statistics about SLRU caches
Previous Message Tom Lane 2020-04-01 21:32:02 pgsql: Add support for binary I/O of ltree, lquery, and ltxtquery types