/ Check-in [893d58c2]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Allow constraint names on DEFAULT values in a table definition. Ticket #2109. (CVS 3535)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 893d58c23da2a9b900a13eaa5202d94429862136
User & Date: drh 2006-12-20 02:15:00
Context
2006-12-20
03:24
The query optimizer does a better job of optimizing out ORDER BY clauses that contain the rowid or which use indices that contain the rowid. Ticket #2116. (CVS 3536) check-in: f245f5c2 user: drh tags: trunk
02:15
Allow constraint names on DEFAULT values in a table definition. Ticket #2109. (CVS 3535) check-in: 893d58c2 user: drh tags: trunk
2006-12-19
18:57
Build without warnings and pass all tests with SQLITE_OMIT_LOAD_EXTENSION. Ticket #2113. (CVS 3534) check-in: c3d118b4 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/parse.y.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
**
*************************************************************************
** 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.211 2006/12/16 16:25:15 drh Exp $
*/

// All token codes are small integers with #defines that begin with "TK_"
%token_prefix TK_

// The type of the data attached to each token is Token.  This is also the
// default type for non-terminals.
................................................................................
// "carglist" is a list of additional constraints that come after the
// column name and column type in a CREATE TABLE statement.
//
carglist ::= carglist carg.
carglist ::= .
carg ::= CONSTRAINT nm ccons.
carg ::= ccons.
carg ::= DEFAULT term(X).            {sqlite3AddDefaultValue(pParse,X);}
carg ::= DEFAULT LP expr(X) RP.      {sqlite3AddDefaultValue(pParse,X);}
carg ::= DEFAULT PLUS term(X).       {sqlite3AddDefaultValue(pParse,X);}
carg ::= DEFAULT MINUS term(X).      {
  Expr *p = sqlite3Expr(TK_UMINUS, X, 0, 0);
  sqlite3AddDefaultValue(pParse,p);
}
carg ::= DEFAULT id(X).              {
  Expr *p = sqlite3Expr(TK_STRING, 0, 0, &X);
  sqlite3AddDefaultValue(pParse,p);
}

// In addition to the type name, we also care about the primary key and
// UNIQUE constraints.
//







|







 







|
|
|
|



|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
**
*************************************************************************
** 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.212 2006/12/20 02:15:00 drh Exp $
*/

// All token codes are small integers with #defines that begin with "TK_"
%token_prefix TK_

// The type of the data attached to each token is Token.  This is also the
// default type for non-terminals.
................................................................................
// "carglist" is a list of additional constraints that come after the
// column name and column type in a CREATE TABLE statement.
//
carglist ::= carglist carg.
carglist ::= .
carg ::= CONSTRAINT nm ccons.
carg ::= ccons.
ccons ::= DEFAULT term(X).            {sqlite3AddDefaultValue(pParse,X);}
ccons ::= DEFAULT LP expr(X) RP.      {sqlite3AddDefaultValue(pParse,X);}
ccons ::= DEFAULT PLUS term(X).       {sqlite3AddDefaultValue(pParse,X);}
ccons ::= DEFAULT MINUS term(X).      {
  Expr *p = sqlite3Expr(TK_UMINUS, X, 0, 0);
  sqlite3AddDefaultValue(pParse,p);
}
ccons ::= DEFAULT id(X).              {
  Expr *p = sqlite3Expr(TK_STRING, 0, 0, &X);
  sqlite3AddDefaultValue(pParse,p);
}

// In addition to the type name, we also care about the primary key and
// UNIQUE constraints.
//