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

Allow omitting one or both boundaries in an array slice specifier.

Omitted boundaries represent the upper or lower limit of the corresponding
array subscript.  This allows simpler specification of many common
use-cases.

(Revised version of commit 9246af6799)

YUriy Zhuravlev
This commit is contained in:
Tom Lane
2015-12-22 21:05:16 -05:00
parent 0ba3f3bc65
commit 6efbded6e4
15 changed files with 302 additions and 33 deletions

View File

@@ -157,9 +157,10 @@ typedef struct Query
List *constraintDeps; /* a list of pg_constraint OIDs that the query
* depends on to be semantically valid */
List *withCheckOptions; /* a list of WithCheckOption's, which are
* only added during rewrite and therefore
* are not written out as part of Query. */
List *withCheckOptions; /* a list of WithCheckOption's, which
* are only added during rewrite and
* therefore are not written out as
* part of Query. */
} Query;
@@ -351,13 +352,17 @@ typedef struct A_Star
} A_Star;
/*
* A_Indices - array subscript or slice bounds ([lidx:uidx] or [uidx])
* A_Indices - array subscript or slice bounds ([idx] or [lidx:uidx])
*
* In slice case, either or both of lidx and uidx can be NULL (omitted).
* In non-slice case, uidx holds the single subscript and lidx is always NULL.
*/
typedef struct A_Indices
{
NodeTag type;
Node *lidx; /* NULL if it's a single subscript */
Node *uidx;
bool is_slice; /* true if slice (i.e., colon present) */
Node *lidx; /* slice lower bound, if any */
Node *uidx; /* subscript, or slice upper bound if any */
} A_Indices;
/*