aboutsummaryrefslogtreecommitdiff
path: root/src/resolve.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2020-06-29 20:20:40 +0000
committerdrh <drh@noemail.net>2020-06-29 20:20:40 +0000
commitec43d8040a063d39b5fccf24c60c4b206cafa671 (patch)
tree230c8fc1793f7dd1d8cc7a010b46f101fc5d31ab /src/resolve.c
parentda36933eb4192ddf4fbc836b7e419258f0b7d2c1 (diff)
downloadsqlite-ec43d8040a063d39b5fccf24c60c4b206cafa671.tar.gz
sqlite-ec43d8040a063d39b5fccf24c60c4b206cafa671.zip
Change the magic number used to identify the "excluded" pseudo-table in
an UPSERT statement into a #define constant. FossilOrigin-Name: e96c2ac9ab1a1c51b1498f4b91fb71d2987c30579d072b2f0297da9eb945cb97
Diffstat (limited to 'src/resolve.c')
-rw-r--r--src/resolve.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/resolve.c b/src/resolve.c
index aff6dbead..3b88073da 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -17,6 +17,11 @@
#include "sqliteInt.h"
/*
+** Magic table number to mean the EXCLUDED table in an UPSERT statement.
+*/
+#define EXCLUDED_TABLE_NUMBER 2
+
+/*
** Walk the expression tree pExpr and increase the aggregate function
** depth (the Expr.op2 field) by N on every TK_AGG_FUNCTION node.
** This needs to occur when copying a TK_AGG_FUNCTION node from an
@@ -386,7 +391,7 @@ static int lookupName(
Upsert *pUpsert = pNC->uNC.pUpsert;
if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){
pTab = pUpsert->pUpsertSrc->a[0].pTab;
- pExpr->iTable = 2;
+ pExpr->iTable = EXCLUDED_TABLE_NUMBER;
}
}
#endif /* SQLITE_OMIT_UPSERT */
@@ -411,7 +416,7 @@ static int lookupName(
if( iCol<pTab->nCol ){
cnt++;
#ifndef SQLITE_OMIT_UPSERT
- if( pExpr->iTable==2 ){
+ if( pExpr->iTable==EXCLUDED_TABLE_NUMBER ){
testcase( iCol==(-1) );
if( IN_RENAME_OBJECT ){
pExpr->iColumn = iCol;