/ Check-in [54d96772]
Login

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

Overview
Comment:Merge changes from trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | upsert
Files: files | file ages | folders
SHA3-256: 54d96772e78b7f57d5b590aebe34a139ade73629aebe16677372650b33513b1d
User & Date: drh 2018-04-16 10:47:38
Context
2018-04-16
13:00
Add support for the "excluded.*" names in the UPDATE clause of an upsert. check-in: 0203f34f user: drh tags: upsert
10:47
Merge changes from trunk. check-in: 54d96772 user: drh tags: upsert
10:41
Increase the version number to 3.24.0 check-in: f94528e1 user: drh tags: trunk
2018-04-14
22:35
Get upsert working on WITHOUT ROWID tables. check-in: d3c53fd3 user: drh tags: upsert
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to VERSION.

     1         -3.23.1
            1  +3.24.0

Changes to configure.

     1      1   #! /bin/sh
     2      2   # Guess values for system-dependent variables and create Makefiles.
     3         -# Generated by GNU Autoconf 2.69 for sqlite 3.23.1.
            3  +# Generated by GNU Autoconf 2.69 for sqlite 3.24.0.
     4      4   #
     5      5   #
     6      6   # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
     7      7   #
     8      8   #
     9      9   # This configure script is free software; the Free Software Foundation
    10     10   # gives unlimited permission to copy, distribute and modify it.
................................................................................
   722    722   subdirs=
   723    723   MFLAGS=
   724    724   MAKEFLAGS=
   725    725   
   726    726   # Identity of this package.
   727    727   PACKAGE_NAME='sqlite'
   728    728   PACKAGE_TARNAME='sqlite'
   729         -PACKAGE_VERSION='3.23.1'
   730         -PACKAGE_STRING='sqlite 3.23.1'
          729  +PACKAGE_VERSION='3.24.0'
          730  +PACKAGE_STRING='sqlite 3.24.0'
   731    731   PACKAGE_BUGREPORT=''
   732    732   PACKAGE_URL=''
   733    733   
   734    734   # Factoring default headers for most tests.
   735    735   ac_includes_default="\
   736    736   #include <stdio.h>
   737    737   #ifdef HAVE_SYS_TYPES_H
................................................................................
  1461   1461   #
  1462   1462   # Report the --help message.
  1463   1463   #
  1464   1464   if test "$ac_init_help" = "long"; then
  1465   1465     # Omit some internal or obsolete options to make the list less imposing.
  1466   1466     # This message is too long to be a string in the A/UX 3.1 sh.
  1467   1467     cat <<_ACEOF
  1468         -\`configure' configures sqlite 3.23.1 to adapt to many kinds of systems.
         1468  +\`configure' configures sqlite 3.24.0 to adapt to many kinds of systems.
  1469   1469   
  1470   1470   Usage: $0 [OPTION]... [VAR=VALUE]...
  1471   1471   
  1472   1472   To assign environment variables (e.g., CC, CFLAGS...), specify them as
  1473   1473   VAR=VALUE.  See below for descriptions of some of the useful variables.
  1474   1474   
  1475   1475   Defaults for the options are specified in brackets.
................................................................................
  1526   1526     --build=BUILD     configure for building on BUILD [guessed]
  1527   1527     --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  1528   1528   _ACEOF
  1529   1529   fi
  1530   1530   
  1531   1531   if test -n "$ac_init_help"; then
  1532   1532     case $ac_init_help in
  1533         -     short | recursive ) echo "Configuration of sqlite 3.23.1:";;
         1533  +     short | recursive ) echo "Configuration of sqlite 3.24.0:";;
  1534   1534      esac
  1535   1535     cat <<\_ACEOF
  1536   1536   
  1537   1537   Optional Features:
  1538   1538     --disable-option-checking  ignore unrecognized --enable/--with options
  1539   1539     --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  1540   1540     --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
................................................................................
  1651   1651       cd "$ac_pwd" || { ac_status=$?; break; }
  1652   1652     done
  1653   1653   fi
  1654   1654   
  1655   1655   test -n "$ac_init_help" && exit $ac_status
  1656   1656   if $ac_init_version; then
  1657   1657     cat <<\_ACEOF
  1658         -sqlite configure 3.23.1
         1658  +sqlite configure 3.24.0
  1659   1659   generated by GNU Autoconf 2.69
  1660   1660   
  1661   1661   Copyright (C) 2012 Free Software Foundation, Inc.
  1662   1662   This configure script is free software; the Free Software Foundation
  1663   1663   gives unlimited permission to copy, distribute and modify it.
  1664   1664   _ACEOF
  1665   1665     exit
................................................................................
  2070   2070     eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  2071   2071   
  2072   2072   } # ac_fn_c_check_header_mongrel
  2073   2073   cat >config.log <<_ACEOF
  2074   2074   This file contains any messages produced by compilers while
  2075   2075   running configure, to aid debugging if configure makes a mistake.
  2076   2076   
  2077         -It was created by sqlite $as_me 3.23.1, which was
         2077  +It was created by sqlite $as_me 3.24.0, which was
  2078   2078   generated by GNU Autoconf 2.69.  Invocation command line was
  2079   2079   
  2080   2080     $ $0 $@
  2081   2081   
  2082   2082   _ACEOF
  2083   2083   exec 5>>config.log
  2084   2084   {
................................................................................
 12238  12238   test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
 12239  12239   
 12240  12240   cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 12241  12241   # Save the log message, to keep $0 and so on meaningful, and to
 12242  12242   # report actual input values of CONFIG_FILES etc. instead of their
 12243  12243   # values after options handling.
 12244  12244   ac_log="
 12245         -This file was extended by sqlite $as_me 3.23.1, which was
        12245  +This file was extended by sqlite $as_me 3.24.0, which was
 12246  12246   generated by GNU Autoconf 2.69.  Invocation command line was
 12247  12247   
 12248  12248     CONFIG_FILES    = $CONFIG_FILES
 12249  12249     CONFIG_HEADERS  = $CONFIG_HEADERS
 12250  12250     CONFIG_LINKS    = $CONFIG_LINKS
 12251  12251     CONFIG_COMMANDS = $CONFIG_COMMANDS
 12252  12252     $ $0 $@
................................................................................
 12304  12304   
 12305  12305   Report bugs to the package provider."
 12306  12306   
 12307  12307   _ACEOF
 12308  12308   cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 12309  12309   ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 12310  12310   ac_cs_version="\\
 12311         -sqlite config.status 3.23.1
        12311  +sqlite config.status 3.24.0
 12312  12312   configured by $0, generated by GNU Autoconf 2.69,
 12313  12313     with options \\"\$ac_cs_config\\"
 12314  12314   
 12315  12315   Copyright (C) 2012 Free Software Foundation, Inc.
 12316  12316   This config.status script is free software; the Free Software Foundation
 12317  12317   gives unlimited permission to copy, distribute and modify it."
 12318  12318   

Changes to src/expr.c.

  5253   5253   ** for additional information.
  5254   5254   */
  5255   5255   static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
  5256   5256     int i;
  5257   5257     NameContext *pNC = pWalker->u.pNC;
  5258   5258     Parse *pParse = pNC->pParse;
  5259   5259     SrcList *pSrcList = pNC->pSrcList;
  5260         -  AggInfo *pAggInfo = pNC->pAggInfo;
         5260  +  AggInfo *pAggInfo = pNC->uNC.pAggInfo;
  5261   5261   
         5262  +  assert( pNC->ncFlags & NC_UAggInfo );
  5262   5263     switch( pExpr->op ){
  5263   5264       case TK_AGG_COLUMN:
  5264   5265       case TK_COLUMN: {
  5265   5266         testcase( pExpr->op==TK_AGG_COLUMN );
  5266   5267         testcase( pExpr->op==TK_COLUMN );
  5267   5268         /* Check to see if the column is in one of the tables in the FROM
  5268   5269         ** clause of the aggregate query */

Changes to src/resolve.c.

   379    379       **
   380    380       ** The ability to use an output result-set column in the WHERE, GROUP BY,
   381    381       ** or HAVING clauses, or as part of a larger expression in the ORDER BY
   382    382       ** clause is not standard SQL.  This is a (goofy) SQLite extension, that
   383    383       ** is supported for backwards compatibility only. Hence, we issue a warning
   384    384       ** on sqlite3_log() whenever the capability is used.
   385    385       */
   386         -    if( (pEList = pNC->pEList)!=0
   387         -     && zTab==0
          386  +    if( (pNC->ncFlags & NC_UEList)!=0
   388    387        && cnt==0
          388  +     && zTab==0
   389    389       ){
          390  +      pEList = pNC->uNC.pEList;
          391  +      assert( pEList!=0 );
   390    392         for(j=0; j<pEList->nExpr; j++){
   391    393           char *zAs = pEList->a[j].zName;
   392    394           if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
   393    395             Expr *pOrig;
   394    396             assert( pExpr->pLeft==0 && pExpr->pRight==0 );
   395    397             assert( pExpr->x.pList==0 );
   396    398             assert( pExpr->x.pSelect==0 );
................................................................................
   911    913     pEList = pSelect->pEList;
   912    914   
   913    915     /* Resolve all names in the ORDER BY term expression
   914    916     */
   915    917     memset(&nc, 0, sizeof(nc));
   916    918     nc.pParse = pParse;
   917    919     nc.pSrcList = pSelect->pSrc;
   918         -  nc.pEList = pEList;
   919         -  nc.ncFlags = NC_AllowAgg;
          920  +  nc.uNC.pEList = pEList;
          921  +  nc.ncFlags = NC_AllowAgg|NC_UEList;
   920    922     nc.nErr = 0;
   921    923     db = pParse->db;
   922    924     savedSuppErr = db->suppressErr;
   923    925     db->suppressErr = 1;
   924    926     rc = sqlite3ResolveExprNames(&nc, pE);
   925    927     db->suppressErr = savedSuppErr;
   926    928     if( rc ) return 0;
................................................................................
  1295   1297       ** other expressions in the SELECT statement. This is so that
  1296   1298       ** expressions in the WHERE clause (etc.) can refer to expressions by
  1297   1299       ** aliases in the result set.
  1298   1300       **
  1299   1301       ** Minor point: If this is the case, then the expression will be
  1300   1302       ** re-evaluated for each reference to it.
  1301   1303       */
  1302         -    sNC.pEList = p->pEList;
         1304  +    assert( (sNC.ncFlags & (NC_UAggInfo))==0 );
         1305  +    sNC.uNC.pEList = p->pEList;
         1306  +    sNC.ncFlags |= NC_UEList;
  1303   1307       if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
  1304   1308       if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;
  1305   1309   
  1306   1310       /* Resolve names in table-valued-function arguments */
  1307   1311       for(i=0; i<p->pSrc->nSrc; i++){
  1308   1312         struct SrcList_item *pItem = &p->pSrc->a[i];
  1309   1313         if( pItem->fg.isTabFunc

Changes to src/select.c.

  5679   5679       /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in
  5680   5680       ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the
  5681   5681       ** SELECT statement.
  5682   5682       */
  5683   5683       memset(&sNC, 0, sizeof(sNC));
  5684   5684       sNC.pParse = pParse;
  5685   5685       sNC.pSrcList = pTabList;
  5686         -    sNC.pAggInfo = &sAggInfo;
         5686  +    sNC.uNC.pAggInfo = &sAggInfo;
         5687  +    VVA_ONLY( sNC.ncFlags = NC_UAggInfo; )
  5687   5688       sAggInfo.mnReg = pParse->nMem+1;
  5688   5689       sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr : 0;
  5689   5690       sAggInfo.pGroupBy = pGroupBy;
  5690   5691       sqlite3ExprAnalyzeAggList(&sNC, pEList);
  5691   5692       sqlite3ExprAnalyzeAggList(&sNC, sSort.pOrderBy);
  5692   5693       if( pHaving ){
  5693   5694         if( pGroupBy ){

Changes to src/sqliteInt.h.

  2678   2678   ** NameContext in the parent query.  Thus the process of scanning the
  2679   2679   ** NameContext list corresponds to searching through successively outer
  2680   2680   ** subqueries looking for a match.
  2681   2681   */
  2682   2682   struct NameContext {
  2683   2683     Parse *pParse;       /* The parser */
  2684   2684     SrcList *pSrcList;   /* One or more tables used to resolve names */
  2685         -  ExprList *pEList;    /* Optional list of result-set columns */
  2686         -  AggInfo *pAggInfo;   /* Information about aggregates at this level */
         2685  +  union {
         2686  +    ExprList *pEList;    /* Optional list of result-set columns */
         2687  +    AggInfo *pAggInfo;   /* Information about aggregates at this level */
         2688  +  } uNC;
  2687   2689     NameContext *pNext;  /* Next outer name context.  NULL for outermost */
  2688   2690     int nRef;            /* Number of names resolved by this context */
  2689   2691     int nErr;            /* Number of errors encountered while resolving names */
  2690   2692     u16 ncFlags;         /* Zero or more NC_* flags defined below */
  2691   2693   };
  2692   2694   
  2693   2695   /*
................................................................................
  2701   2703   #define NC_AllowAgg  0x0001  /* Aggregate functions are allowed here */
  2702   2704   #define NC_PartIdx   0x0002  /* True if resolving a partial index WHERE */
  2703   2705   #define NC_IsCheck   0x0004  /* True if resolving names in a CHECK constraint */
  2704   2706   #define NC_InAggFunc 0x0008  /* True if analyzing arguments to an agg func */
  2705   2707   #define NC_HasAgg    0x0010  /* One or more aggregate functions seen */
  2706   2708   #define NC_IdxExpr   0x0020  /* True if resolving columns of CREATE INDEX */
  2707   2709   #define NC_VarSelect 0x0040  /* A correlated subquery has been seen */
         2710  +#define NC_UEList    0x0080  /* True if uNC.pEList is used */
         2711  +#define NC_UAggInfo  0x0100  /* True if uNC.pAggInfo is used */
  2708   2712   #define NC_MinMaxAgg 0x1000  /* min/max aggregates seen.  See note above */
  2709   2713   #define NC_Complex   0x2000  /* True if a function or subquery seen */
  2710   2714   
  2711   2715   /*
  2712   2716   ** An instance of the following object describes a single ON CONFLICT
  2713   2717   ** clause in an upsert.
  2714   2718   **