mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Fix lquery's behavior for consecutive '*' items.
Something like "*{2}.*{3}" should presumably mean the same as "*{5}", but it didn't. Improve that. Get rid of an undocumented and remarkably ugly (though not, as far as I can tell, actually unsafe) static variable in favor of passing more arguments to checkCond(). Reverse-engineer some commentary. This function, like all of ltree, is still far short of what I would consider the minimum acceptable level of internal documentation, but at least now it has more than zero comments. Although this certainly seems like a bug fix, people might not thank us for changing query behavior in stable branches, so no back-patch. Nikita Glukhov, with cosmetic improvements by me Discussion: https://postgr.es/m/CAP_rww=waX2Oo6q+MbMSiZ9ktdj6eaJj0cQzNu=Ry2cCDij5fw@mail.gmail.com
This commit is contained in:
@ -34,7 +34,7 @@ typedef struct
|
||||
{
|
||||
int32 val;
|
||||
uint16 len;
|
||||
uint8 flag;
|
||||
uint8 flag; /* see LVAR_xxx flags below */
|
||||
char name[FLEXIBLE_ARRAY_MEMBER];
|
||||
} lquery_variant;
|
||||
|
||||
@ -47,11 +47,12 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16 totallen;
|
||||
uint16 flag;
|
||||
uint16 numvar;
|
||||
uint16 low;
|
||||
uint16 high;
|
||||
uint16 totallen; /* total length of this level, in bytes */
|
||||
uint16 flag; /* see LQL_xxx flags below */
|
||||
uint16 numvar; /* number of variants; 0 means '*' */
|
||||
uint16 low; /* minimum repeat count for '*' */
|
||||
uint16 high; /* maximum repeat count for '*' */
|
||||
/* Array of maxalign'd lquery_variant structs follows: */
|
||||
char variants[FLEXIBLE_ARRAY_MEMBER];
|
||||
} lquery_level;
|
||||
|
||||
@ -60,6 +61,7 @@ typedef struct
|
||||
#define LQL_FIRST(x) ( (lquery_variant*)( ((char*)(x))+LQL_HDRSIZE ) )
|
||||
|
||||
#define LQL_NOT 0x10
|
||||
|
||||
#ifdef LOWER_NODE
|
||||
#define FLG_CANLOOKSIGN(x) ( ( (x) & ( LQL_NOT | LVAR_ANYEND | LVAR_SUBLEXEME ) ) == 0 )
|
||||
#else
|
||||
@ -70,9 +72,10 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
int32 vl_len_; /* varlena header (do not touch directly!) */
|
||||
uint16 numlevel;
|
||||
uint16 numlevel; /* number of lquery_levels */
|
||||
uint16 firstgood;
|
||||
uint16 flag;
|
||||
uint16 flag; /* see LQUERY_xxx flags below */
|
||||
/* Array of maxalign'd lquery_level structs follows: */
|
||||
char data[FLEXIBLE_ARRAY_MEMBER];
|
||||
} lquery;
|
||||
|
||||
|
Reference in New Issue
Block a user