]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
When a "pragma main.table_info(...)" is issued, consider only tables from the main...
authordanielk1977 <danielk1977@noemail.net>
Wed, 20 Aug 2008 16:34:24 +0000 (16:34 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Wed, 20 Aug 2008 16:34:24 +0000 (16:34 +0000)
FossilOrigin-Name: d0cfbbbaeef7b8ce9f73c6cd58888989a2df5b1f

manifest
manifest.uuid
src/pragma.c
test/pragma.test

index bd43f6f6b66ef29972a7b2e4718f90f2f8211228..5412048800c627d87213d86bae80d199376694ee 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\stypo\sin\smain.c:\sSQLITE_MAX_ATTACH\s->\sSQLITE_MAX_ATTACHED.\sTicket\s#3319.\s(CVS\s5567)
-D 2008-08-20T16:21:12
+C When\sa\s"pragma\smain.table_info(...)"\sis\sissued,\sconsider\sonly\stables\sfrom\sthe\smain\sdatabase,\snot\sthe\stemp\sdb.\sTicket\s#3320.\s(CVS\s5568)
+D 2008-08-20T16:34:24
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in e277c1f6dee97c18ef2f64db608da63eea4cc933
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -140,7 +140,7 @@ F src/pager.h fb9376af5ba8e1eb78ee3b4f15eb0f60658ffd65
 F src/parse.y 84003422b2862f82bd187dfa2399557fd1f4ecbe
 F src/pcache.c c1a9abb5e2aa3d1d52a2995c8e0a36535d4d1bc2
 F src/pcache.h 71ade7a84ed87d9d20507315260b1d91808d7c9a
-F src/pragma.c 6e207b4f69901089758c02c02e0bf86ed12a4d8f
+F src/pragma.c f5b271b090af7fcedd308d7c5807a5503f7a853d
 F src/prepare.c fceb567b359daaa6c6e2a4d04a01dec01ac0c907
 F src/printf.c 2e984b2507291a7e16d89dc9bb60582904f6247d
 F src/random.c 5c754319d38abdd6acd74601ee0105504adc508a
@@ -444,7 +444,7 @@ F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
 F test/pageropt.test 3ee6578891baaca967f0bd349e4abfa736229e1a
 F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e
 F test/permutations.test 4ad59e4489255b025aac0cc661789d35a83d87ec
-F test/pragma.test 2c675ed9a288094ed62bf55b35fbc749e25670fb
+F test/pragma.test b55931bbd5dd543e56fd942dbf4b7439619b09a6
 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
 F test/printf.test 262a5acd3158f788e9bdf7f18d718f3af32ff6ef
 F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 x
@@ -621,7 +621,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P cb494e10d71852024647aaa254203579ad438ea9
-R d898350f4044b9e4cf9b478d2288a8ab
+P 66ff55efd688703fe99143e4c17e8d5f119d0690
+R 0d247ce1493fb2ede2a50a5e354297e6
 U danielk1977
-Z 98a270009068c853c61f64d820ba1780
+Z 33cfa9a4ef54e991c9419dcc5b206894
index 9f68196cfebe620a9a8a56db9f8a5521d8d57c69..72d7e75fe387488cb8d75d9cde1662fe490c2822 100644 (file)
@@ -1 +1 @@
-66ff55efd688703fe99143e4c17e8d5f119d0690
\ No newline at end of file
+d0cfbbbaeef7b8ce9f73c6cd58888989a2df5b1f
\ No newline at end of file
index 6ffc60d58c2c472d3da9f4b43889d051021bb9d1..3c65bb03792c74ec5b7c8ff428a2f5185c994135 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** This file contains code used to implement the PRAGMA command.
 **
-** $Id: pragma.c,v 1.183 2008/07/28 19:34:53 drh Exp $
+** $Id: pragma.c,v 1.184 2008/08/20 16:34:24 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -275,7 +275,7 @@ void sqlite3Pragma(
     zRight = sqlite3NameFromToken(db, pValue);
   }
 
-  zDb = ((iDb>0)?pDb->zName:0);
+  zDb = ((pId2 && pId2->n>0)?pDb->zName:0);
   if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){
     goto pragma_out;
   }
index 2857cfed18b39b69f7ce285726a8963d3ccfecc4..0abb5f91d3713c7e8529d221fae87e7361ed642d 100644 (file)
@@ -12,7 +12,7 @@
 #
 # This file implements tests for the PRAGMA command.
 #
-# $Id: pragma.test,v 1.64 2008/07/12 14:52:20 drh Exp $
+# $Id: pragma.test,v 1.65 2008/08/20 16:34:24 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -541,6 +541,33 @@ do_test pragma-6.5 {
     pragma index_info(t3i1);
   }
 } {0 0 a 1 1 b}
+
+ifcapable tempdb {
+  # Test for ticket #3320. When a temp table of the same name exists, make
+  # sure the schema of the main table can still be queried using 
+  # "pragma table_info":
+  do_test pragma-6.6.1 {
+    execsql {
+      CREATE TABLE trial(col_main);
+      CREATE TEMP TABLE trial(col_temp);
+    }
+  } {}
+  do_test pragma-6.6.2 {
+    execsql {
+      PRAGMA table_info(trial);
+    }
+  } {0 col_temp {} 0 {} 0}
+  do_test pragma-6.6.3 {
+    execsql {
+      PRAGMA temp.table_info(trial);
+    }
+  } {0 col_temp {} 0 {} 0}
+  do_test pragma-6.6.4 {
+    execsql {
+      PRAGMA main.table_info(trial);
+    }
+  } {0 col_main {} 0 {} 0}
+}
 } ;# ifcapable schema_pragmas
 # Miscellaneous tests
 #