Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Correct handling of views on tables with quoted column names. Ticket #756. (CVS 1826) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
8ac5a8ad5eec381585adb6812fc39a1a |
User & Date: | drh 2004-07-20 00:20:23.000 |
Context
2004-07-20
| ||
00:39 | Comment out all of date/time functions with SQLITE_OMIT_DATETIME_FUNCS. Ticket #784. (CVS 1828) (check-in: 4e2ad572ea user: drh tags: trunk) | |
00:20 | Correct handling of views on tables with quoted column names. Ticket #756. (CVS 1826) (check-in: 8ac5a8ad5e user: drh tags: trunk) | |
2004-07-19
| ||
23:38 | Refinements to the LIMIT patch (1823) for ticket #749. (CVS 1825) (check-in: 9d4f43f030 user: drh tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** ** $Id: select.c,v 1.200 2004/07/20 00:20:23 drh Exp $ */ #include "sqliteInt.h" /* ** Allocate a new Select structure and return a pointer to that ** structure. |
︙ | ︙ | |||
841 842 843 844 845 846 847 848 849 850 851 852 853 854 | }else if( p->span.z && p->span.z[0] ){ sqlite3SetNString(&pTab->aCol[i].zName, p->span.z, p->span.n, 0); }else{ char zBuf[30]; sprintf(zBuf, "column%d", i+1); pTab->aCol[i].zName = sqliteStrDup(zBuf); } zType = sqliteStrDup(columnType(pParse, pSelect->pSrc ,p)); pTab->aCol[i].zType = zType; pTab->aCol[i].affinity = SQLITE_AFF_NUMERIC; if( zType ){ pTab->aCol[i].affinity = sqlite3AffinityType(zType, strlen(zType)); } | > | 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 | }else if( p->span.z && p->span.z[0] ){ sqlite3SetNString(&pTab->aCol[i].zName, p->span.z, p->span.n, 0); }else{ char zBuf[30]; sprintf(zBuf, "column%d", i+1); pTab->aCol[i].zName = sqliteStrDup(zBuf); } sqlite3Dequote(aCol[i].zName); zType = sqliteStrDup(columnType(pParse, pSelect->pSrc ,p)); pTab->aCol[i].zType = zType; pTab->aCol[i].affinity = SQLITE_AFF_NUMERIC; if( zType ){ pTab->aCol[i].affinity = sqlite3AffinityType(zType, strlen(zType)); } |
︙ | ︙ |
Changes to test/subselect.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing SELECT statements that are part of # expressions. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing SELECT statements that are part of # expressions. # # $Id: subselect.test,v 1.8 2004/07/20 00:20:23 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Basic sanity checking. Try a simple subselect. # do_test subselect-1.1 { |
︙ | ︙ | |||
145 146 147 148 149 150 151 152 | } } {3} do_test subselect-3.9 { execsql { SELECT (SELECT x FROM t3 ORDER BY x DESC LIMIT 1 OFFSET 2); } } {4} | < < | 145 146 147 148 149 150 151 152 153 | } } {3} do_test subselect-3.9 { execsql { SELECT (SELECT x FROM t3 ORDER BY x DESC LIMIT 1 OFFSET 2); } } {4} finish_test |
Changes to test/view.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2002 February 26 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing VIEW statements. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2002 February 26 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing VIEW statements. # # $Id: view.test,v 1.18 2004/07/20 00:20:23 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test view-1.0 { execsql { CREATE TABLE t1(a,b,c); INSERT INTO t1 VALUES(1,2,3); |
︙ | ︙ | |||
381 382 383 384 385 386 387 | } {5 1 4 2 3 4} do_test view-9.6 { execsql { SELECT * FROM v10 ORDER BY 1; } } {3 4 4 2 5 1} | > > | > > > > > > > > > > > > > > > | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | } {5 1 4 2 3 4} do_test view-9.6 { execsql { SELECT * FROM v10 ORDER BY 1; } } {3 4 4 2 5 1} # Tables with columns having peculiar quoted names used in views # Ticket #756. # do_test view-10.1 { execsql { CREATE TABLE t3("9" integer, [4] text); INSERT INTO t3 VALUES(1,2); CREATE VIEW v_t3_a AS SELECT a.[9] FROM t3 AS a; CREATE VIEW v_t3_b AS SELECT "4" FROM t3; SELECT * FROM v_t3_a; } } {1} do_test view-10.2 { execsql { SELECT * FROM v_t3_b; } } {2} finish_test |