/ Check-in [440705b9]
Login

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

Overview
Comment:Update to requirements marks related to changes in the memory allocation interface and enhancement of the documentation regarding DEFAULT clauses in CREATE TABLE.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 440705b98a3429b830ea85e71cc1e414bc6d8058
User & Date: drh 2014-10-03 14:54:47
Context
2014-10-03
16:00
Add requirements marks on the sqlite3_db_status() interface implementation. Fix a typo in the documentation. Fix the new sqlite3_result_text64() routine so that it works correctly with an encoding parameter of SQLITE_UTF16. check-in: d2fc3227 user: drh tags: trunk
14:54
Update to requirements marks related to changes in the memory allocation interface and enhancement of the documentation regarding DEFAULT clauses in CREATE TABLE. check-in: 440705b9 user: drh tags: trunk
2014-10-02
21:52
Avoid a NULL pointer deference when processing the IS operator if the right-hand side is an illegal "#ID" style variable. Fix for ticket [8c32a33a53092c85a15b] check-in: ffe75736 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/malloc.c.

   306    306     }else if( sqlite3GlobalConfig.bMemstat ){
   307    307       sqlite3_mutex_enter(mem0.mutex);
   308    308       mallocWithAlarm((int)n, &p);
   309    309       sqlite3_mutex_leave(mem0.mutex);
   310    310     }else{
   311    311       p = sqlite3GlobalConfig.m.xMalloc((int)n);
   312    312     }
   313         -  assert( EIGHT_BYTE_ALIGNMENT(p) );  /* IMP: R-04675-44850 */
          313  +  assert( EIGHT_BYTE_ALIGNMENT(p) );  /* IMP: R-11148-40995 */
   314    314     return p;
   315    315   }
   316    316   
   317    317   /*
   318    318   ** This version of the memory allocation is for use by the application.
   319    319   ** First make sure the memory subsystem is initialized, then do the
   320    320   ** allocation.
................................................................................
   529    529   /*
   530    530   ** Change the size of an existing memory allocation
   531    531   */
   532    532   void *sqlite3Realloc(void *pOld, u64 nBytes){
   533    533     int nOld, nNew, nDiff;
   534    534     void *pNew;
   535    535     if( pOld==0 ){
   536         -    return sqlite3Malloc(nBytes); /* IMP: R-28354-25769 */
          536  +    return sqlite3Malloc(nBytes); /* IMP: R-04300-56712 */
   537    537     }
   538    538     if( nBytes==0 ){
   539         -    sqlite3_free(pOld); /* IMP: R-31593-10574 */
          539  +    sqlite3_free(pOld); /* IMP: R-26507-47431 */
   540    540       return 0;
   541    541     }
   542    542     if( nBytes>=0x7fffff00 ){
   543    543       /* The 0x7ffff00 limit term is explained in comments on sqlite3Malloc() */
   544    544       return 0;
   545    545     }
   546    546     nOld = sqlite3MallocSize(pOld);
................................................................................
   569    569         nNew = sqlite3MallocSize(pNew);
   570    570         sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nNew-nOld);
   571    571       }
   572    572       sqlite3_mutex_leave(mem0.mutex);
   573    573     }else{
   574    574       pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
   575    575     }
   576         -  assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-04675-44850 */
          576  +  assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-11148-40995 */
   577    577     return pNew;
   578    578   }
   579    579   
   580    580   /*
   581    581   ** The public interface to sqlite3Realloc.  Make sure that the memory
   582    582   ** subsystem is initialized prior to invoking sqliteRealloc.
   583    583   */
   584    584   void *sqlite3_realloc(void *pOld, int n){
   585    585   #ifndef SQLITE_OMIT_AUTOINIT
   586    586     if( sqlite3_initialize() ) return 0;
   587    587   #endif
   588         -  if( n<0 ) n = 0;
          588  +  if( n<0 ) n = 0;  /* IMP: R-26507-47431 */
   589    589     return sqlite3Realloc(pOld, n);
   590    590   }
   591    591   void *sqlite3_realloc64(void *pOld, sqlite3_uint64 n){
   592    592   #ifndef SQLITE_OMIT_AUTOINIT
   593    593     if( sqlite3_initialize() ) return 0;
   594    594   #endif
   595    595     return sqlite3Realloc(pOld, n);

Changes to test/e_createtable.test.

   858    858     execsql { DELETE FROM t1 }
   859    859   } {
   860    860     1   "INSERT INTO t1(x, y) VALUES('abc', 'xyz')"   {'abc' 'xyz' NULL}
   861    861     2   "INSERT INTO t1(x, z) VALUES('abc', 'xyz')"   {'abc' NULL 'xyz'}
   862    862     3   "INSERT INTO t1 DEFAULT VALUES"               {NULL NULL NULL}
   863    863   }
   864    864   
   865         -# EVIDENCE-OF: R-62940-43005 An explicit DEFAULT clause may specify that
          865  +# EVIDENCE-OF: R-07343-35026 An explicit DEFAULT clause may specify that
   866    866   # the default value is NULL, a string constant, a blob constant, a
   867         -# signed-number, or any constant expression enclosed in parentheses. An
   868         -# explicit default value may also be one of the special case-independent
   869         -# keywords CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP.
          867  +# signed-number, or any constant expression enclosed in parentheses. A
          868  +# default value may also be one of the special case-independent keywords
          869  +# CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP.
   870    870   #
   871    871   do_execsql_test e_createtable-3.3.1 {
   872    872     CREATE TABLE t4(
   873    873       a DEFAULT NULL,
   874    874       b DEFAULT 'string constant',
   875    875       c DEFAULT X'424C4F42',
   876    876       d DEFAULT 1,
................................................................................
   880    880       h DEFAULT ( substr('abcd', 0, 2) || 'cd' ),
   881    881       i DEFAULT CURRENT_TIME,
   882    882       j DEFAULT CURRENT_DATE,
   883    883       k DEFAULT CURRENT_TIMESTAMP
   884    884     );
   885    885   } {}
   886    886   
   887         -# EVIDENCE-OF: R-36381-62919 For the purposes of the DEFAULT clause, an
   888         -# expression is considered constant provided that it does not contain
   889         -# any sub-queries, column or table references, or string literals
          887  +# EVIDENCE-OF: R-18415-27776 For the purposes of the DEFAULT clause, an
          888  +# expression is considered constant if it does contains no sub-queries,
          889  +# column or table references, bound parameters, or string literals
   890    890   # enclosed in double-quotes instead of single-quotes.
   891    891   #
   892    892   do_createtable_tests 3.4.1 -error {
   893    893     default value of column [x] is not constant
   894    894   } {
   895    895     1   {CREATE TABLE t5(x DEFAULT ( (SELECT 1) ))}  {}
   896    896     2   {CREATE TABLE t5(x DEFAULT ( "abc" ))}  {}
   897    897     3   {CREATE TABLE t5(x DEFAULT ( 1 IN (SELECT 1) ))}  {}
   898    898     4   {CREATE TABLE t5(x DEFAULT ( EXISTS (SELECT 1) ))}  {}
          899  +  5   {CREATE TABLE t5(x DEFAULT ( x!=?1 ))}  {}
   899    900   }
   900    901   do_createtable_tests 3.4.2 -repair {
   901    902     catchsql { DROP TABLE t5 }
   902    903   } {
   903    904     1   {CREATE TABLE t5(x DEFAULT ( 'abc' ))}  {}
   904    905     2   {CREATE TABLE t5(x DEFAULT ( 1 IN (1, 2, 3) ))}  {}
   905    906   }