/ Check-in [3196f5f4]
Login

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

Overview
Comment:Merge latest trunk changes with this branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | reuse-schema
Files: files | file ages | folders
SHA3-256: 3196f5f480f221dc71bb92e6718a5c356782774be25df4df79dda0ac1101255a
User & Date: dan 2019-03-21 17:22:05
Wiki:reuse-schema
Context
2019-03-26
11:57
Merge recent trunk enhancements. check-in: db4e2cc3 user: drh tags: reuse-schema
2019-03-21
17:22
Merge latest trunk changes with this branch. check-in: 3196f5f4 user: dan tags: reuse-schema
17:13
Disable the feature on this branch in non-SQLITE_ENABLE_SHARED_SCHEMA builds. check-in: b8e53608 user: dan tags: reuse-schema
2019-03-20
18:22
In the CLI, give better error messages if something goes wrong with the ".dbinfo" command. check-in: 3649a77b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

  1455   1455     }
  1456   1456     if( nTerm==1
  1457   1457      && pCol
  1458   1458      && sqlite3StrICmp(sqlite3ColumnType(pCol,""), "INTEGER")==0
  1459   1459      && sortOrder!=SQLITE_SO_DESC
  1460   1460     ){
  1461   1461       if( IN_RENAME_OBJECT && pList ){
  1462         -      sqlite3RenameTokenRemap(pParse, &pTab->iPKey, pList->a[0].pExpr);
         1462  +      Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[0].pExpr);
         1463  +      sqlite3RenameTokenRemap(pParse, &pTab->iPKey, pCExpr);
  1463   1464       }
  1464   1465       pTab->iPKey = iCol;
  1465   1466       pTab->keyConf = (u8)onError;
  1466   1467       assert( autoInc==0 || autoInc==1 );
  1467   1468       pTab->tabFlags |= autoInc*TF_Autoincrement;
  1468   1469       if( pList ) pParse->iPkSortOrder = pList->a[0].sortOrder;
  1469   1470     }else if( autoInc ){

Changes to src/shell.c.in.

  5100   5100        { "number of triggers:",
  5101   5101          "SELECT count(*) FROM %s WHERE type='trigger'" },
  5102   5102        { "number of views:",
  5103   5103          "SELECT count(*) FROM %s WHERE type='view'" },
  5104   5104        { "schema size:",
  5105   5105          "SELECT total(length(sql)) FROM %s" },
  5106   5106     };
  5107         -  int i;
         5107  +  int i, rc;
  5108   5108     unsigned iDataVersion;
  5109   5109     char *zSchemaTab;
  5110   5110     char *zDb = nArg>=2 ? azArg[1] : "main";
  5111   5111     sqlite3_stmt *pStmt = 0;
  5112   5112     unsigned char aHdr[100];
  5113   5113     open_db(p, 0);
  5114   5114     if( p->db==0 ) return 1;
  5115         -  sqlite3_prepare_v2(p->db,"SELECT data FROM sqlite_dbpage(?1) WHERE pgno=1",
  5116         -                     -1, &pStmt, 0);
         5115  +  rc = sqlite3_prepare_v2(p->db,
         5116  +             "SELECT data FROM sqlite_dbpage(?1) WHERE pgno=1",
         5117  +             -1, &pStmt, 0);
         5118  +  if( rc ){
         5119  +    if( !sqlite3_compileoption_used("ENABLE_DBPAGE_VTAB") ){
         5120  +      utf8_printf(stderr, "the \".dbinfo\" command requires the "
         5121  +                          "-DSQLITE_ENABLE_DBPAGE_VTAB compile-time options\n");
         5122  +    }else{
         5123  +      utf8_printf(stderr, "error: %s\n", sqlite3_errmsg(p->db));
         5124  +    }
         5125  +    sqlite3_finalize(pStmt);
         5126  +    return 1;
         5127  +  }
  5117   5128     sqlite3_bind_text(pStmt, 1, zDb, -1, SQLITE_STATIC);
  5118   5129     if( sqlite3_step(pStmt)==SQLITE_ROW
  5119   5130      && sqlite3_column_bytes(pStmt,0)>100
  5120   5131     ){
  5121   5132       memcpy(aHdr, sqlite3_column_blob(pStmt,0), 100);
  5122   5133       sqlite3_finalize(pStmt);
  5123   5134     }else{

Changes to test/altertab3.test.

   109    109   } {1 {error in trigger tr1: no such table: main.t2}}
   110    110   do_execsql_test 4.2.2 {
   111    111     COMMIT;
   112    112   }
   113    113   do_execsql_test 4.2.3 {
   114    114     SELECT * FROM sqlite_master WHERE type='table' AND name!='t1';
   115    115   } {table t3 t3 3 {CREATE TABLE t3(e, f)}}
          116  +
          117  +#-------------------------------------------------------------------------
          118  +reset_db
          119  +do_execsql_test 5.0 {
          120  +  CREATE TABLE t1 (
          121  +      c1 integer, c2, PRIMARY KEY(c1 collate rtrim),
          122  +      UNIQUE(c2)
          123  +  )
          124  +}
          125  +do_execsql_test 5.1 {
          126  +  ALTER TABLE t1 RENAME c1 TO c3;
          127  +}
          128  +
          129  +#-------------------------------------------------------------------------
          130  +reset_db
          131  +do_execsql_test 6.0 {
          132  +  CREATE TEMPORARY TABLE Table0 (
          133  +    Col0 INTEGER, 
          134  +    PRIMARY KEY(Col0 COLLATE RTRIM), 
          135  +    FOREIGN KEY (Col0) REFERENCES Table0
          136  +  );
          137  +}
          138  +
          139  +do_execsql_test 6.1 {
          140  +  ALTER TABLE Table0 RENAME Col0 TO Col0;
          141  +}
   116    142   
   117    143   finish_test
   118    144   
   119    145