/ Check-in [893d58c2]
Login

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 Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/parse.y.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains SQLite's grammar for SQL.  Process this file
    13     13   ** using the lemon parser generator to generate C code that runs
    14     14   ** the parser.  Lemon will also generate a header file containing
    15     15   ** numeric codes for all of the tokens.
    16     16   **
    17         -** @(#) $Id: parse.y,v 1.211 2006/12/16 16:25:15 drh Exp $
           17  +** @(#) $Id: parse.y,v 1.212 2006/12/20 02:15:00 drh Exp $
    18     18   */
    19     19   
    20     20   // All token codes are small integers with #defines that begin with "TK_"
    21     21   %token_prefix TK_
    22     22   
    23     23   // The type of the data attached to each token is Token.  This is also the
    24     24   // default type for non-terminals.
................................................................................
   245    245   // "carglist" is a list of additional constraints that come after the
   246    246   // column name and column type in a CREATE TABLE statement.
   247    247   //
   248    248   carglist ::= carglist carg.
   249    249   carglist ::= .
   250    250   carg ::= CONSTRAINT nm ccons.
   251    251   carg ::= ccons.
   252         -carg ::= DEFAULT term(X).            {sqlite3AddDefaultValue(pParse,X);}
   253         -carg ::= DEFAULT LP expr(X) RP.      {sqlite3AddDefaultValue(pParse,X);}
   254         -carg ::= DEFAULT PLUS term(X).       {sqlite3AddDefaultValue(pParse,X);}
   255         -carg ::= DEFAULT MINUS term(X).      {
          252  +ccons ::= DEFAULT term(X).            {sqlite3AddDefaultValue(pParse,X);}
          253  +ccons ::= DEFAULT LP expr(X) RP.      {sqlite3AddDefaultValue(pParse,X);}
          254  +ccons ::= DEFAULT PLUS term(X).       {sqlite3AddDefaultValue(pParse,X);}
          255  +ccons ::= DEFAULT MINUS term(X).      {
   256    256     Expr *p = sqlite3Expr(TK_UMINUS, X, 0, 0);
   257    257     sqlite3AddDefaultValue(pParse,p);
   258    258   }
   259         -carg ::= DEFAULT id(X).              {
          259  +ccons ::= DEFAULT id(X).              {
   260    260     Expr *p = sqlite3Expr(TK_STRING, 0, 0, &X);
   261    261     sqlite3AddDefaultValue(pParse,p);
   262    262   }
   263    263   
   264    264   // In addition to the type name, we also care about the primary key and
   265    265   // UNIQUE constraints.
   266    266   //