1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Allow hyphens in ltree labels

Also increase the allowed length of labels to 1000 characters

Garen Torikian

Discussion: https://postgr.es/m/CAGXsc+-mNg9Gc0rp-ER0sv+zkZSZp2wE9-LX6XcoWSLVz22tZA@mail.gmail.com
This commit is contained in:
Andrew Dunstan
2023-01-06 16:03:19 -05:00
parent a46a7011b2
commit b1665bf01e
6 changed files with 60 additions and 38 deletions

View File

@ -74,7 +74,7 @@ parse_ltree(const char *buf, struct Node *escontext)
switch (state)
{
case LTPRS_WAITNAME:
if (ISALNUM(ptr))
if (ISLABEL(ptr))
{
lptr->start = ptr;
lptr->wlen = 0;
@ -92,7 +92,7 @@ parse_ltree(const char *buf, struct Node *escontext)
lptr++;
state = LTPRS_WAITNAME;
}
else if (!ISALNUM(ptr))
else if (!ISLABEL(ptr))
UNCHAR;
break;
default:
@ -316,7 +316,7 @@ parse_lquery(const char *buf, struct Node *escontext)
switch (state)
{
case LQPRS_WAITLEVEL:
if (ISALNUM(ptr))
if (ISLABEL(ptr))
{
GETVAR(curqlevel) = lptr = (nodeitem *) palloc0(sizeof(nodeitem) * (numOR + 1));
lptr->start = ptr;
@ -339,7 +339,7 @@ parse_lquery(const char *buf, struct Node *escontext)
UNCHAR;
break;
case LQPRS_WAITVAR:
if (ISALNUM(ptr))
if (ISLABEL(ptr))
{
lptr++;
lptr->start = ptr;
@ -385,7 +385,7 @@ parse_lquery(const char *buf, struct Node *escontext)
state = LQPRS_WAITLEVEL;
curqlevel = NEXTLEV(curqlevel);
}
else if (ISALNUM(ptr))
else if (ISLABEL(ptr))
{
/* disallow more chars after a flag */
if (lptr->flag)