From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Dominique Devienne <ddevienne(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Latest patches break one of our unit-test, related to RLS |
Date: | 2025-09-13 01:17:17 |
Message-ID: | 501ee89ad54184804d14b416781dafd340c789d3.camel@cybertec.at |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, 2025-09-12 at 20:12 -0400, Tom Lane wrote:
> I had not particularly studied the new charclass-parsing logic.
> Looking at it now, this bit further down (lines 871ff) looks
> fishy:
>
> if (pchar == ']' && charclass_start > 2)
> charclass_depth--;
> else if (pchar == '[')
> charclass_depth++;
>
> /*
> * If there is a caret right after the opening bracket, it negates
> * the character class, but a following closing bracket should
> * still be treated as a normal character. That holds only for
> * the first caret, so only the values 1 and 2 mean that closing
> * brackets should be taken literally.
> */
> if (pchar == '^')
> charclass_start++;
> else
> charclass_start = 3; /* definitely past the start */
>
> Should not we be setting charclass_start to 1 after incrementing
> charclass_depth?
What I call "charclass depth" is misleading, I am afraid.
Really, it should be "bracket depth". Only the outermost pair of brackets
starts an actual character class. Example:
[]abc[:digit:]]
A caret or closing bracket right after the inner opening bracket wouldn't
be a special character, and I think it would never be legal.
Unfortunately, this is all pretty complicated.
Perhaps s/charclass_depth/bracket_depth/ would be a good idea.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-09-13 01:53:17 | Re: Latest patches break one of our unit-test, related to RLS |
Previous Message | Tom Lane | 2025-09-13 00:12:03 | Re: Latest patches break one of our unit-test, related to RLS |