diff options
author | drh <> | 2021-08-23 10:28:02 +0000 |
---|---|---|
committer | drh <> | 2021-08-23 10:28:02 +0000 |
commit | b9fd0101bd350b5256a72bf3567fd9ad2e60c4b3 (patch) | |
tree | 48fe251e5637945fc3f1535087e183c38a2b529c /src | |
parent | 2a0eefd66536fea7ac7f57d67ce97aa0b1da7338 (diff) | |
download | sqlite-b9fd0101bd350b5256a72bf3567fd9ad2e60c4b3.tar.gz sqlite-b9fd0101bd350b5256a72bf3567fd9ad2e60c4b3.zip |
Back out the change that allows typeless columns in strict tables. Replace
that capability with an ANY type for strict tables that will accept any
datatype with BLOB affinity.
FossilOrigin-Name: d8fd1a2bfd51848ea612142d23475b268b3f5269e558f2e09713d1ac18b18274
Diffstat (limited to 'src')
-rw-r--r-- | src/build.c | 17 | ||||
-rw-r--r-- | src/global.c | 5 | ||||
-rw-r--r-- | src/sqliteInt.h | 13 | ||||
-rw-r--r-- | src/vdbe.c | 2 |
4 files changed, 24 insertions, 13 deletions
diff --git a/src/build.c b/src/build.c index b80eef8dc..f2b3d2544 100644 --- a/src/build.c +++ b/src/build.c @@ -2606,12 +2606,19 @@ void sqlite3EndTable( p->tabFlags |= TF_Strict; for(ii=0; ii<p->nCol; ii++){ Column *pCol = &p->aCol[ii]; - if( pCol->eCType==COLTYPE_CUSTOM && pCol->colFlags & COLFLAG_HASTYPE ){ - sqlite3ErrorMsg(pParse, - "unknown datatype for %s.%s: \"%s\"", - p->zName, pCol->zCnName, sqlite3ColumnType(pCol, "") - ); + if( pCol->eCType==COLTYPE_CUSTOM ){ + if( pCol->colFlags & COLFLAG_HASTYPE ){ + sqlite3ErrorMsg(pParse, + "unknown datatype for %s.%s: \"%s\"", + p->zName, pCol->zCnName, sqlite3ColumnType(pCol, "") + ); + }else{ + sqlite3ErrorMsg(pParse, "missing datatype for %s.%s", + p->zName, pCol->zCnName); + } return; + }else if( pCol->eCType==COLTYPE_ANY ){ + pCol->affinity = SQLITE_AFF_BLOB; } if( (pCol->colFlags & COLFLAG_PRIMKEY)!=0 && p->iPKey!=ii diff --git a/src/global.c b/src/global.c index 091310c93..675cdec23 100644 --- a/src/global.c +++ b/src/global.c @@ -364,8 +364,9 @@ const char sqlite3StrBINARY[] = "BINARY"; ** sqlite3_column_type() or sqlite3_value_type()) ** for each entry in sqlite3StdType[]. */ -const unsigned char sqlite3StdTypeLen[] = { 4, 3, 7, 4, 4 }; +const unsigned char sqlite3StdTypeLen[] = { 3, 4, 3, 7, 4, 4 }; const char sqlite3StdTypeAffinity[] = { + SQLITE_AFF_NUMERIC, SQLITE_AFF_BLOB, SQLITE_AFF_INTEGER, SQLITE_AFF_INTEGER, @@ -373,6 +374,7 @@ const char sqlite3StdTypeAffinity[] = { SQLITE_AFF_TEXT }; const char sqlite3StdTypeMap[] = { + 0, SQLITE_BLOB, SQLITE_INTEGER, SQLITE_INTEGER, @@ -380,6 +382,7 @@ const char sqlite3StdTypeMap[] = { SQLITE_TEXT }; const char *sqlite3StdType[] = { + "ANY", "BLOB", "INT", "INTEGER", diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 348a41393..5308ca95c 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2055,12 +2055,13 @@ struct Column { ** Adjust the SQLITE_N_STDTYPE value if adding or removing entries. */ #define COLTYPE_CUSTOM 0 /* Type appended to zName */ -#define COLTYPE_BLOB 1 -#define COLTYPE_INT 2 -#define COLTYPE_INTEGER 3 -#define COLTYPE_REAL 4 -#define COLTYPE_TEXT 5 -#define SQLITE_N_STDTYPE 5 /* Number of standard types */ +#define COLTYPE_ANY 1 +#define COLTYPE_BLOB 2 +#define COLTYPE_INT 3 +#define COLTYPE_INTEGER 4 +#define COLTYPE_REAL 5 +#define COLTYPE_TEXT 6 +#define SQLITE_N_STDTYPE 6 /* Number of standard types */ /* Allowed values for Column.colFlags. ** diff --git a/src/vdbe.c b/src/vdbe.c index 92d904135..5ac770c05 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -2974,7 +2974,7 @@ case OP_TypeCheck: { break; } default: { - /* anything goes */ + /* COLTYPE_ANY. Accept anything. */ break; } } |