diff options
author | danielk1977 <danielk1977@noemail.net> | 2006-06-21 12:36:25 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2006-06-21 12:36:25 +0000 |
commit | 5ee9d6977f475a1de1d59ceea60bd84d9f49bcfa (patch) | |
tree | c902b2f7a3fb935ddf5edc93255b67f88a637b9d /src | |
parent | 9d1b2a28f82a4406dee245ece668f0243bdbd86e (diff) | |
download | sqlite-5ee9d6977f475a1de1d59ceea60bd84d9f49bcfa.tar.gz sqlite-5ee9d6977f475a1de1d59ceea60bd84d9f49bcfa.zip |
Add tests to make sure altering or adding an index to a virtual table is prohibited. (CVS 3280)
FossilOrigin-Name: 6c3e8852ffbaf5ab52ffdf7ed3767fa1d4fd5882
Diffstat (limited to 'src')
-rw-r--r-- | src/alter.c | 15 | ||||
-rw-r--r-- | src/build.c | 8 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/alter.c b/src/alter.c index 224cfa4b6..efab598ed 100644 --- a/src/alter.c +++ b/src/alter.c @@ -12,7 +12,7 @@ ** This file contains C code routines that used to generate VDBE code ** that implements the ALTER TABLE command. ** -** $Id: alter.c,v 1.20 2006/02/09 02:56:03 drh Exp $ +** $Id: alter.c,v 1.21 2006/06/21 12:36:25 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -272,6 +272,12 @@ void sqlite3AlterRenameTable( pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase); if( !pTab ) goto exit_rename_table; +#ifndef SQLITE_OMIT_VIRTUALTABLE + if( IsVirtual(pTab) ){ + sqlite3ErrorMsg(pParse, "virtual tables may not be altered"); + goto exit_rename_table; + } +#endif iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); zDb = db->aDb[iDb].zName; @@ -512,6 +518,13 @@ void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ pTab = sqlite3LocateTable(pParse, pSrc->a[0].zName, pSrc->a[0].zDatabase); if( !pTab ) goto exit_begin_add_column; +#ifndef SQLITE_OMIT_VIRTUALTABLE + if( IsVirtual(pTab) ){ + sqlite3ErrorMsg(pParse, "virtual tables may not be altered"); + goto exit_begin_add_column; + } +#endif + /* Make sure this is not an attempt to ALTER a view. */ if( pTab->pSelect ){ sqlite3ErrorMsg(pParse, "Cannot add a column to a view"); diff --git a/src/build.c b/src/build.c index 84464bfbf..df9015ff3 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.406 2006/06/21 07:34:11 danielk1977 Exp $ +** $Id: build.c,v 1.407 2006/06/21 12:36:25 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -2304,6 +2304,12 @@ void sqlite3CreateIndex( goto exit_create_index; } #endif +#ifndef SQLITE_OMIT_VIRTUALTABLE + if( IsVirtual(pTab) ){ + sqlite3ErrorMsg(pParse, "virtual tables may not be indexed"); + goto exit_create_index; + } +#endif /* ** Find the name of the index. Make sure there is not already another |