From: drh Date: Tue, 22 Dec 2009 00:29:53 +0000 (+0000) Subject: Add a pragma to disable the query flattener - for use during testing. X-Git-Tag: version-3.7.2~687 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b688ede643ffa287d5874198b57883d0edf9850;p=thirdparty%2Fsqlite.git Add a pragma to disable the query flattener - for use during testing. FossilOrigin-Name: 1d8550e5c88db0ea76aea579c1a5bf99d48fbe43 --- diff --git a/manifest b/manifest index 1609170a22..3d209f05c2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,8 @@ -C Change\smany\scomments\sin\se_fkey.test\sto\sinclude\sthe\sfull\stext\sof\sthe\scorresponding\sstatement\sin\sforeignkeys.html. -D 2009-12-21T08:53:18 +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +C Add\sa\spragma\sto\sdisable\sthe\squery\sflattener\s-\sfor\suse\sduring\stesting. +D 2009-12-22T00:29:53 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -156,17 +159,17 @@ F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e F src/pcache.c 3b079306376e0e04c0d3df40c0a4b750a1839310 F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050 F src/pcache1.c 2bb2261190b42a348038f5b1c285c8cef415fcc8 -F src/pragma.c 6936d7df5e04b9f996f8f320d15e65b6944b2caa +F src/pragma.c c194fc135754c700fefc6f7fbe77e90b1dc40aff F src/prepare.c 170bd953058efe1c46b8ad9020d49cd6f40f0b45 F src/printf.c 644bc7d59df3dc56d6d8b9a510914bfc6b51bc69 F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50 F src/resolve.c d052e5c44bab34f83b3c1741aaa07478d18b5dd5 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 -F src/select.c 68c58dc49341472e4e5661a47a1a9e5f8a161340 +F src/select.c 9b5ad0e12b2a95fe9cf48d383b6fec5ca31b6a72 F src/shell.c b9fae60b0f2ce306c20fa99e83c75023bf35f15b F src/sqlite.h.in 176e993dce3c9cfe5610aca0ef99f4dfd70896bb F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89 -F src/sqliteInt.h 93d5d01d9ea57b95ba709733dce830ec056deb84 +F src/sqliteInt.h eddc248fb88d76f0c77be45fa72099c48af243af F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6 F src/status.c e651be6b30d397d86384c6867bc016e4913bcac7 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e @@ -782,7 +785,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 956de051f43dfc2f178a7820981da4bf69927190 -R 0e65c6161f89cc3a34b587f96c1c2049 -U dan -Z e3737637173861a53abcf3ec5e22169c +P 4b489ecb250ea0e80d5bf8806f07259e1107f8ad +R 4ff394e3e8f370cfe3bb1a4f517ce068 +U drh +Z a149efdbc300f2ef9c4bcc0e34bf2979 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQFLMBMFoxKgR168RlERAq3/AJ9DzTzxkRrhdye4sGLAI1OEQJXZUQCbB/A0 +oHnyJeYGpcPNKCuD7OdyWhQ= +=RmkK +-----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 661e2cb4a8..a2597f3c4f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4b489ecb250ea0e80d5bf8806f07259e1107f8ad \ No newline at end of file +1d8550e5c88db0ea76aea579c1a5bf99d48fbe43 \ No newline at end of file diff --git a/src/pragma.c b/src/pragma.c index 0afce9706d..9aa43148b8 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -185,6 +185,9 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){ { "writable_schema", SQLITE_WriteSchema|SQLITE_RecoveryMode }, { "omit_readlock", SQLITE_NoReadlock }, + /* For testing purposes only */ + { "omit_flattener", SQLITE_OmitFlattener }, + /* TODO: Maybe it shouldn't be possible to change the ReadUncommitted ** flag if there are any active statements. */ { "read_uncommitted", SQLITE_ReadUncommitted }, diff --git a/src/select.c b/src/select.c index 80c2366869..00d26b7b0d 100644 --- a/src/select.c +++ b/src/select.c @@ -957,7 +957,7 @@ static const char *columnType( ** of the SELECT statement. Return the declaration type and origin ** data for the result-set column of the sub-select. */ - if( ALWAYS(iCol>=0 && iColpEList->nExpr) ){ + if( iCol>=0 && ALWAYS(iColpEList->nExpr) ){ /* If iCol is less than zero, then the expression requests the ** rowid of the sub-select or view. This expression is legal (see ** test case misc2.2.2) - it always evaluates to NULL. @@ -2518,7 +2518,7 @@ static void substSelect( ** ** (11) The subquery and the outer query do not both have ORDER BY clauses. ** -** (12) Not implemented. Subsumed into restriction (3). Was previously +** (**) Not implemented. Subsumed into restriction (3). Was previously ** a separate restriction deriving from ticket #350. ** ** (13) The subquery and outer query do not both use LIMIT @@ -2592,6 +2592,13 @@ static int flattenSubquery( */ assert( p!=0 ); assert( p->pPrior==0 ); /* Unable to flatten compound queries */ + + /* The "PRAGMA omit_flattener=ON" statement disables query flattening for + ** testing purposes. The only reason to disable the query flattener is + ** to verify that we get the same answer with and without the flattener. + ** In production use, there is never a reason to turn the flattener off. */ + if( db->flags & SQLITE_OmitFlattener ) return 0; + pSrc = p->pSrc; assert( pSrc && iFrom>=0 && iFromnSrc ); pSubitem = &pSrc->a[iFrom]; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 1e15dbd167..29cad13783 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -920,15 +920,15 @@ struct sqlite3 { #define SQLITE_NoReadlock 0x00001000 /* Readlocks are omitted when ** accessing read-only databases */ #define SQLITE_IgnoreChecks 0x00002000 /* Do not enforce check constraints */ -#define SQLITE_ReadUncommitted 0x00004000 /* For shared-cache mode */ +#define SQLITE_ReadUncommitted 0x0004000 /* For shared-cache mode */ #define SQLITE_LegacyFileFmt 0x00008000 /* Create new databases in format 1 */ #define SQLITE_FullFSync 0x00010000 /* Use full fsync on the backend */ #define SQLITE_LoadExtension 0x00020000 /* Enable load_extension */ - #define SQLITE_RecoveryMode 0x00040000 /* Ignore schema errors */ #define SQLITE_ReverseOrder 0x00100000 /* Reverse unordered SELECTs */ #define SQLITE_RecTriggers 0x00200000 /* Enable recursive triggers */ -#define SQLITE_ForeignKeys 0x00400000 /* Enforce foreign key constraints */ +#define SQLITE_ForeignKeys 0x00400000 /* Enforce foreign key constraints */ +#define SQLITE_OmitFlattener 0x00800000 /* Do not flatten queries */ /* ** Possible values for the sqlite.magic field.