SQLite

Check-in [d2bdc0feeb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix for bug #3: Allow VIEW as a column name. Also allow COPY. (CVS 507)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d2bdc0feeb3a3595850f40ab211df7a3963d6c30
User & Date: drh 2002-03-30 15:26:51.000
Context
2002-03-30
15:27
Update the change log to include the previous commit. (CVS 508) (check-in: 81c4b74961 user: drh tags: trunk)
15:26
Fix for bug #3: Allow VIEW as a column name. Also allow COPY. (CVS 507) (check-in: d2bdc0feeb user: drh tags: trunk)
14:15
Describe the difference between the binary RPMs in the download.html file. (CVS 506) (check-in: 8ce9a1fad2 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/parse.y.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** This file contains SQLite's grammar for SQL.  Process this file
** using the lemon parser generator to generate C code that runs
** the parser.  Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
** @(#) $Id: parse.y,v 1.58 2002/03/24 13:13:29 drh Exp $
*/
%token_prefix TK_
%token_type {Token}
%default_type {Token}
%extra_argument {Parse *pParse}
%syntax_error {
  sqliteSetString(&pParse->zErrMsg,"syntax error",0);







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
**
*************************************************************************
** This file contains SQLite's grammar for SQL.  Process this file
** using the lemon parser generator to generate C code that runs
** the parser.  Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
** @(#) $Id: parse.y,v 1.59 2002/03/30 15:26:51 drh Exp $
*/
%token_prefix TK_
%token_type {Token}
%default_type {Token}
%extra_argument {Parse *pParse}
%syntax_error {
  sqliteSetString(&pParse->zErrMsg,"syntax error",0);
93
94
95
96
97
98
99
100
101
102
103
104
105


106
107
108
109
110
111
112
113
114
115
116
117

118
119
120
121
122
123
124

// An IDENTIFIER can be a generic identifier, or one of several
// keywords.  Any non-standard keyword can also be an identifier.
// We also make DESC and identifier since it comes up so often (as
// an abbreviation of "description").
//
%type id {Token}
id(A) ::= DESC(X).       {A = X;}
id(A) ::= ASC(X).        {A = X;}
id(A) ::= DELIMITERS(X). {A = X;}
id(A) ::= EXPLAIN(X).    {A = X;}
id(A) ::= VACUUM(X).     {A = X;}
id(A) ::= BEGIN(X).      {A = X;}


id(A) ::= END(X).        {A = X;}
id(A) ::= PRAGMA(X).     {A = X;}
id(A) ::= CLUSTER(X).    {A = X;}
id(A) ::= ID(X).         {A = X;}
id(A) ::= TEMP(X).       {A = X;}
id(A) ::= OFFSET(X).     {A = X;}
id(A) ::= KEY(X).        {A = X;}
id(A) ::= ABORT(X).      {A = X;}
id(A) ::= IGNORE(X).     {A = X;}
id(A) ::= REPLACE(X).    {A = X;}
id(A) ::= FAIL(X).       {A = X;}
id(A) ::= CONFLICT(X).   {A = X;}


// And "ids" is an identifer-or-string.
//
%type ids {Token}
ids(A) ::= id(X).        {A = X;}
ids(A) ::= STRING(X).    {A = X;}








|

|
|
|
|
>
>

|
|

<
|

|
|

|
|
>







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

// An IDENTIFIER can be a generic identifier, or one of several
// keywords.  Any non-standard keyword can also be an identifier.
// We also make DESC and identifier since it comes up so often (as
// an abbreviation of "description").
//
%type id {Token}
id(A) ::= ABORT(X).      {A = X;}
id(A) ::= ASC(X).        {A = X;}
id(A) ::= BEGIN(X).      {A = X;}
id(A) ::= CLUSTER(X).    {A = X;}
id(A) ::= CONFLICT(X).   {A = X;}
id(A) ::= COPY(X).       {A = X;}
id(A) ::= DELIMITERS(X). {A = X;}
id(A) ::= DESC(X).       {A = X;}
id(A) ::= END(X).        {A = X;}
id(A) ::= EXPLAIN(X).    {A = X;}
id(A) ::= FAIL(X).       {A = X;}
id(A) ::= ID(X).         {A = X;}

id(A) ::= IGNORE(X).     {A = X;}
id(A) ::= KEY(X).        {A = X;}
id(A) ::= OFFSET(X).     {A = X;}
id(A) ::= PRAGMA(X).     {A = X;}
id(A) ::= REPLACE(X).    {A = X;}
id(A) ::= TEMP(X).       {A = X;}
id(A) ::= VACUUM(X).     {A = X;}
id(A) ::= VIEW(X).       {A = X;}

// And "ids" is an identifer-or-string.
//
%type ids {Token}
ids(A) ::= id(X).        {A = X;}
ids(A) ::= STRING(X).    {A = X;}

Changes to test/misc1.test.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc1.test,v 1.4 2002/03/13 18:54:08 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Test the creation and use of tables that have a large number
# of columns.
#







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests for miscellanous features that were
# left out of other test files.
#
# $Id: misc1.test,v 1.5 2002/03/30 15:26:52 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Test the creation and use of tables that have a large number
# of columns.
#
147
148
149
150
151
152
153
154



































155
  }
} {1 {near "WHEREwww": syntax error}}
do_test misc1-5.2 {
  execsql {
    SELECT * FROM t3 ORDER BY a;
  }
} {1 2 3 4}




































finish_test








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
  }
} {1 {near "WHEREwww": syntax error}}
do_test misc1-5.2 {
  execsql {
    SELECT * FROM t3 ORDER BY a;
  }
} {1 2 3 4}

# Certain keywords (especially non-standard keywords like "REPLACE") can
# also be used as identifiers.  The way this works in the parser is that
# the parser first detects a syntax error, the error handling routine
# sees that the special keyword caused the error, then replaces the keyword
# with "ID" and tries again.
#
# Check the operation of this logic.
#
do_test misc1-6.1 {
  catchsql {
    CREATE TABLE t4(
      abort, asc, begin, cluster, conflict, copy, delimiters, desc, end,
      explain, fail, ignore, key, offset, pragma, replace, temp,
      vacuum, view
    );
  }
} {0 {}}
do_test misc1-6.2 {
  catchsql {
    INSERT INTO t4
       VALUES(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
  }
} {0 {}}
do_test misc1-6.3 {
  execsql {
    SELECT * FROM t4
  }
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19}
do_test misc1-6.4 {
  execsql {
    SELECT abort+asc,max(key,pragma,temp) FROM t4
  }
} {3 17}
     

finish_test