aboutsummaryrefslogtreecommitdiff
path: root/src/sqliteInt.h
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-10-30 18:50:08 +0000
committerdrh <drh@noemail.net>2019-10-30 18:50:08 +0000
commit20cee7d0bb8f627c3952f24a5c4772f8fbb4d720 (patch)
tree8fa04661f1fdf2da038495b7517dbfcc964a2984 /src/sqliteInt.h
parent920cf596e67ecccecb497cfa60cc65945048f866 (diff)
downloadsqlite-20cee7d0bb8f627c3952f24a5c4772f8fbb4d720.tar.gz
sqlite-20cee7d0bb8f627c3952f24a5c4772f8fbb4d720.zip
Always disallow the use of non-deterministic functions in CHECK constraints,
even date/time functions that use the 'now' or similar keywords. Provide improved error messages when this requirement is not met. Ticket [830277d9db6c3ba1] FossilOrigin-Name: 2978b65ebe25eeabe543b67cb266308cceb20082a4ae71565d6d083d7c08bc9f
Diffstat (limited to 'src/sqliteInt.h')
-rw-r--r--src/sqliteInt.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index d8668a278..cf7abfe66 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -2487,6 +2487,10 @@ typedef int ynVar;
struct Expr {
u8 op; /* Operation performed by this node */
char affExpr; /* affinity, or RAISE type */
+ u8 op2; /* TK_REGISTER/TK_TRUTH: original value of Expr.op
+ ** TK_COLUMN: the value of p5 for OP_Column
+ ** TK_AGG_FUNCTION: nesting depth
+ ** TK_FUNCTION: NC_SelfRef flag if needs OP_PureFunc */
u32 flags; /* Various flags. EP_* See below */
union {
char *zToken; /* Token value. Zero terminated and dequoted */
@@ -2525,9 +2529,6 @@ struct Expr {
** TK_SELECT_COLUMN: column of the result vector */
i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */
- u8 op2; /* TK_REGISTER/TK_TRUTH: original value of Expr.op
- ** TK_COLUMN: the value of p5 for OP_Column
- ** TK_AGG_FUNCTION: nesting depth */
AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
union {
Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL
@@ -2840,9 +2841,10 @@ struct NameContext {
#define NC_AllowAgg 0x00001 /* Aggregate functions are allowed here */
#define NC_PartIdx 0x00002 /* True if resolving a partial index WHERE */
#define NC_IsCheck 0x00004 /* True if resolving a CHECK constraint */
-#define NC_InAggFunc 0x00008 /* True if analyzing arguments to an agg func */
+#define NC_GenCol 0x00008 /* True for a GENERATED ALWAYS AS clause */
#define NC_HasAgg 0x00010 /* One or more aggregate functions seen */
#define NC_IdxExpr 0x00020 /* True if resolving columns of CREATE INDEX */
+#define NC_SelfRef 0x0002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */
#define NC_VarSelect 0x00040 /* A correlated subquery has been seen */
#define NC_UEList 0x00080 /* True if uNC.pEList is used */
#define NC_UAggInfo 0x00100 /* True if uNC.pAggInfo is used */
@@ -2852,7 +2854,7 @@ struct NameContext {
#define NC_AllowWin 0x04000 /* Window functions are allowed here */
#define NC_HasWin 0x08000 /* One or more window functions seen */
#define NC_IsDDL 0x10000 /* Resolving names in a CREATE statement */
-#define NC_GenCol 0x20000 /* True for a GENERATED ALWAYS AS clause */
+#define NC_InAggFunc 0x20000 /* True if analyzing arguments to an agg func */
/*
** An instance of the following object describes a single ON CONFLICT