Documentation Source Text

Check-in [db3facf719]
Login

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

Overview
Comment:Improvements to the legacy_alter_table pragma documentation. Typo fix in the change log.
Timelines: family | ancestors | descendants | both | branch-3.25
Files: files | file ages | folders
SHA3-256:db3facf719e3b6143b0a83d173c88d475a902f28608c4f517b30ecafa3361691
User & Date: drh 2018-09-25 16:26:17
Context
2018-09-25
19:13
Add hashes to the 3.25.2 change log. check-in: 2770eeff69 user: drh tags: branch-3.25
16:26
Improvements to the legacy_alter_table pragma documentation. Typo fix in the change log. check-in: db3facf719 user: drh tags: branch-3.25
15:02
Preliminary changes for version 3.25.2. check-in: e00e728eae user: drh tags: branch-3.25
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to pages/changes.in.

    25     25   <li> Add the [PRAGMA legacy_alter_table=ON] command that causes the
    26     26        "ALTER TABLE RENAME" command to behave as it did in SQLite versions 3.24.0
    27     27        and earlier: references to the renamed table inside the bodies of triggers
    28     28        and views are not updated.  This new pragma provides a compatibility
    29     29        work around for older programs that expected the older, wonky behavior
    30     30        of ALTER TABLE RENAME.
    31     31   <li> Fix a problem with the new [window functions] implementation that caused
    32         -     a malfunction when compress expressions involving window functions were used
           32  +     a malfunction when complicated expressions involving window functions were used
    33     33        inside of a view.
    34     34   <li> Fixes for various other compiler warnings and minor problems associated
    35     35        with obscure configurations.
    36     36   <p><b>Hashes:</b>
    37     37   <li>SQLITE_SOURCE_ID: <i>pending</i>
    38     38   <li>SHA3-256 for sqlite3.c: <i>pending</i>
    39     39   } {patchagainst 1 patchagainst 2}

Changes to pages/pragma.in.

   772    772   
   773    773   
   774    774   Pragma legacy_alter_table {
   775    775      <p>^(<b>PRAGMA legacy_alter_table;
   776    776          <br>PRAGMA legacy_alter_table = <i>boolean</i></b></p>
   777    777       <p>This pragma sets or queries the value of the legacy_alter_table
   778    778       flag.)^  ^(When this flag is on, the ALTER TABLE RENAME
   779         -    command does not modify references to the renamed table in the
   780         -    body of triggers and views.)^  This mimics the behavior of of
   781         -    SQLite version 3.24.0 ([dateof:3.24.0]) and earlier.  When this
   782         -    flag is off (the default) then the ALTER TABLE RENAME
   783         -    command does update references to the renamed table that occur
   784         -    in the body of triggers and views, as it should.
          779  +    command (for changing the name of a table) works as it did
          780  +    in SQLite 3.24.0 ([dateof:3.24.0]) and earlier.)^  More specifically,
          781  +    when this flag is on
          782  +    the ALTER TABLE RENAME command only rewrites the initial occurrence
          783  +    of the table name in its CREATE TABLE statement and in any associated
          784  +    CREATE INDEX and CREATE TRIGGER statements.  Other references to the
          785  +    table are unmodifed, including:
          786  +    <ul>
          787  +    <li> References to the table within the bodies of triggers and views.
          788  +    <li> References to the table within CHECK constraints in the original
          789  +         CREATE TABLE statement.
          790  +    <li> References to the table within the WHERE clauses of [partial indexes].
          791  +    </ul>
          792  +    The default setting for this pragma is OFF, which means that all
          793  +    references to the table anywhere in the schema are converted to the new name.
   785    794       <p>This pragma is provided as a work-around for older programs that
   786         -    contain code that expect the goofy behavior
          795  +    contain code that expect the incomplete behavior
   787    796       of ALTER TABLE RENAME found in older versions of SQLite.
   788    797       New applications should leave this flag turned off.
   789    798       <p>For compability with older [virtual table] implementations,
   790    799       this flag is turned on temporarily while the [sqlite3_module.xRename]
   791    800       method is being run.  The value of this flag is restore after the 
   792    801       [sqlite3_module.xRename] method finishes.
   793    802   }

Changes to pages/vtab.in.

  1376   1376   that the virtual table will be given a new name. 
  1377   1377   If this method returns [SQLITE_OK] then SQLite renames the table.
  1378   1378   If this method returns an [error code] then the renaming is prevented.
  1379   1379   
  1380   1380   <p>The xRename method is optional.  If omitted, then the virtual
  1381   1381   table may not be renamed using the ALTER TABLE RENAME command.
  1382   1382   
  1383         -<p>The [PRAGMA legacy_alter_table=ON] command is run prior to invoking this
  1384         -method, and the prior value for legacy_alter_table is restored after this
         1383  +<p>The [PRAGMA legacy_alter_table] setting is enabled prior to invoking this
         1384  +method, and the value for legacy_alter_table is restored after this
  1385   1385   method finishes.  This is necessary for the correct operation of virtual
  1386   1386   tables that make use of [shadow tables] where the shadow tables must be
  1387   1387   renamed to match the new virtual table name.  If the legacy_alter_format is
  1388   1388   off, then the xConnect method will be invoked for the virtual table every
  1389   1389   time the xRename method tries to change the name of the shadow table.
  1390   1390   
  1391   1391   <tcl>############################################################# xSavepoint