]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Allow the entire FROM clause of a SELECT statement to be in parentheses. (CVS 5973)
authordrh <drh@noemail.net>
Wed, 3 Dec 2008 23:23:40 +0000 (23:23 +0000)
committerdrh <drh@noemail.net>
Wed, 3 Dec 2008 23:23:40 +0000 (23:23 +0000)
FossilOrigin-Name: 72ebc8cbe00f77f7864146de7c0954c4f1c59b8d

manifest
manifest.uuid
src/parse.y

index 5257f293a28228f4eb28e533947ca46d7439b1ac..ccd83c22218209fd632ff79267be79021ca11e75 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\smissing\sforward\sdeclaration\sthat\sis\sneeded\swhen\nSQLITE_PREFER_PROXY_LOCKING\sis\sdefined.\s(CVS\s5972)
-D 2008-12-03T22:48:33
+C Allow\sthe\sentire\sFROM\sclause\sof\sa\sSELECT\sstatement\sto\sbe\sin\sparentheses.\s(CVS\s5973)
+D 2008-12-03T23:23:41
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 0aa7bbe3be6acc4045706e3bb3fd0b8f38f4a3b5
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -141,7 +141,7 @@ F src/os_unix.c bc3e50bcc7d97c0ea2b75b20bc2b5b96ed677270
 F src/os_win.c 3dff41670fb9798a869c636626bb7d6d8b6a45bb
 F src/pager.c a193da9e271898077de815819e4c29fc2b6ece2a
 F src/pager.h a02ef8e6cc7e78b54874166e5ce786c9d4c489bf
-F src/parse.y 2c4758b4c5ead6de8cf7112f5a7cce7561d313fe
+F src/parse.y 72397fe334b25b4f3411edbf49b5b706f2d7bdae
 F src/pcache.c f3121a531745b20f5b824201eb63949a7e2959ac
 F src/pcache.h f20c3e82dd6da622c3fe296170cb1801f9a2d75a
 F src/pcache1.c d8d412326cc5123ba3bfaa66e36205ca8c5dbc5e
@@ -662,7 +662,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 31f6090e22b54d657afc8c23171d000d47850205
-R 5a18d457ddc309d1c2fbda88075de290
+P 24235300b3f64f0396e1016afbe31aec9ea69b62
+R 5fe88680a50c27fc028c09bed38c5a36
 U drh
-Z e5ab96427cc5098a8e91665c39652c64
+Z c442561901c53c94d9f73bfff4583050
index 6854476c689795256d0666837ab43c415d7b67f3..f7bd3b3a3f8135905f920dc86a25f12eb765c3e1 100644 (file)
@@ -1 +1 @@
-24235300b3f64f0396e1016afbe31aec9ea69b62
\ No newline at end of file
+72ebc8cbe00f77f7864146de7c0954c4f1c59b8d
\ No newline at end of file
index a4416db4fcba4bd83a53f346260414252fd3a202..9a4fbbb3bed9a9783dd40c447703907190fee20b 100644 (file)
@@ -14,7 +14,7 @@
 ** the parser.  Lemon will also generate a header file containing
 ** numeric codes for all of the tokens.
 **
-** @(#) $Id: parse.y,v 1.262 2008/10/23 05:45:07 danielk1977 Exp $
+** @(#) $Id: parse.y,v 1.263 2008/12/03 23:23:41 drh Exp $
 */
 
 // All token codes are small integers with #defines that begin with "TK_"
@@ -444,7 +444,7 @@ as(X) ::= .            {X.n = 0;}
 // A complete FROM clause.
 //
 from(A) ::= .                {A = sqlite3DbMallocZero(pParse->db, sizeof(*A));}
-from(A) ::= FROM seltablist(X).  {
+from(A) ::= FROM seltablist(X). {
   A = X;
   sqlite3SrcListShiftJoinType(A);
 }
@@ -462,22 +462,33 @@ seltablist(A) ::= stl_prefix(X) nm(Y) dbnm(D) as(Z) indexed_opt(I) on_opt(N) usi
   sqlite3SrcListIndexedBy(pParse, A, &I);
 }
 %ifndef SQLITE_OMIT_SUBQUERY
-  seltablist(A) ::= stl_prefix(X) LP seltablist_paren(S) RP
+  seltablist(A) ::= stl_prefix(X) LP select(S) RP
                     as(Z) on_opt(N) using_opt(U). {
     A = sqlite3SrcListAppendFromTerm(pParse,X,0,0,&Z,S,N,U);
   }
+  seltablist(A) ::= stl_prefix(X) LP seltablist(F) RP
+                    as(Z) on_opt(N) using_opt(U). {
+    if( X==0 && Z.n==0 && N==0 && U==0 ){
+      A = F;
+    }else{
+      Select *pSubquery;
+      sqlite3SrcListShiftJoinType(F);
+      pSubquery = sqlite3SelectNew(pParse,0,F,0,0,0,0,0,0,0);
+      A = sqlite3SrcListAppendFromTerm(pParse,X,0,0,&Z,pSubquery,N,U);
+    }
+  }
   
   // A seltablist_paren nonterminal represents anything in a FROM that
   // is contained inside parentheses.  This can be either a subquery or
   // a grouping of table and subqueries.
   //
-  %type seltablist_paren {Select*}
-  %destructor seltablist_paren {sqlite3SelectDelete(pParse->db, $$);}
-  seltablist_paren(A) ::= select(S).      {A = S;}
-  seltablist_paren(A) ::= seltablist(F).  {
-     sqlite3SrcListShiftJoinType(F);
-     A = sqlite3SelectNew(pParse,0,F,0,0,0,0,0,0,0);
-  }
+//  %type seltablist_paren {Select*}
+//  %destructor seltablist_paren {sqlite3SelectDelete(pParse->db, $$);}
+//  seltablist_paren(A) ::= select(S).      {A = S;}
+//  seltablist_paren(A) ::= seltablist(F).  {
+//     sqlite3SrcListShiftJoinType(F);
+//     A = sqlite3SelectNew(pParse,0,F,0,0,0,0,0,0,0);
+//  }
 %endif  SQLITE_OMIT_SUBQUERY
 
 %type dbnm {Token}