aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build.c6
-rw-r--r--src/insert.c5
-rw-r--r--src/select.c2
-rw-r--r--src/sqliteInt.h2
4 files changed, 11 insertions, 4 deletions
diff --git a/src/build.c b/src/build.c
index 0e8d4cf0e..f928ba307 100644
--- a/src/build.c
+++ b/src/build.c
@@ -1052,10 +1052,12 @@ begin_table_error:
/* Set properties of a table column based on the (magical)
** name of the column.
*/
-void sqlite3ColumnPropertiesFromName(Column *pCol){
+void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){
#if SQLITE_ENABLE_HIDDEN_COLUMNS
if( sqlite3_strnicmp(pCol->zName, "__hidden__", 10)==0 ){
pCol->colFlags |= COLFLAG_HIDDEN;
+ }else if( pTab && pCol!=pTab->aCol && (pCol[-1].colFlags & COLFLAG_HIDDEN) ){
+ pTab->tabFlags |= TF_OOOHidden;
}
#endif
}
@@ -1103,7 +1105,7 @@ void sqlite3AddColumn(Parse *pParse, Token *pName){
pCol = &p->aCol[p->nCol];
memset(pCol, 0, sizeof(p->aCol[0]));
pCol->zName = z;
- sqlite3ColumnPropertiesFromName(pCol);
+ sqlite3ColumnPropertiesFromName(p, pCol);
/* If there is no type specified, columns have the default affinity
** 'BLOB'. If there is a type specified, then sqlite3AddColumnType() will
diff --git a/src/insert.c b/src/insert.c
index 618b2dee7..4b8ed2210 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -1909,6 +1909,11 @@ static int xferOptimization(
for(i=0; i<pDest->nCol; i++){
Column *pDestCol = &pDest->aCol[i];
Column *pSrcCol = &pSrc->aCol[i];
+#ifdef SQLITE_ENABLE_HIDDEN_COLUMNS
+ if( (pDestCol->colFlags | pSrcCol->colFlags) & COLFLAG_HIDDEN ){
+ return 0; /* Neither table may have __hidden__ columns */
+ }
+#endif
if( pDestCol->affinity!=pSrcCol->affinity ){
return 0; /* Affinity must be the same on all columns */
}
diff --git a/src/select.c b/src/select.c
index 2cf190b34..967023420 100644
--- a/src/select.c
+++ b/src/select.c
@@ -1659,7 +1659,7 @@ int sqlite3ColumnsFromExprList(
if( cnt>3 ) sqlite3_randomness(sizeof(cnt), &cnt);
}
pCol->zName = zName;
- sqlite3ColumnPropertiesFromName(pCol);
+ sqlite3ColumnPropertiesFromName(0, pCol);
if( zName && sqlite3HashInsert(&ht, zName, pCol)==pCol ){
db->mallocFailed = 1;
}
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 788b348fb..50a0c97eb 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -3331,7 +3331,7 @@ void sqlite3OpenMasterTable(Parse *, int);
Index *sqlite3PrimaryKeyIndex(Table*);
i16 sqlite3ColumnOfIndex(Index*, i16);
void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);
-void sqlite3ColumnPropertiesFromName(Column*);
+void sqlite3ColumnPropertiesFromName(Table*, Column*);
void sqlite3AddColumn(Parse*,Token*);
void sqlite3AddNotNull(Parse*, int);
void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);