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







|







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

782

783


784






785
786
787
788
789
790
791
792
793


Pragma legacy_alter_table {
   <p>^(<b>PRAGMA legacy_alter_table;
       <br>PRAGMA legacy_alter_table = <i>boolean</i></b></p>
    <p>This pragma sets or queries the value of the legacy_alter_table
    flag.)^  ^(When this flag is on, the ALTER TABLE RENAME
    command does not modify references to the renamed table in the
    body of triggers and views.)^  This mimics the behavior of of
    SQLite version 3.24.0 ([dateof:3.24.0]) and earlier.  When this

    flag is off (the default) then the ALTER TABLE RENAME

    command does update references to the renamed table that occur


    in the body of triggers and views, as it should.






    <p>This pragma is provided as a work-around for older programs that
    contain code that expect the goofy behavior
    of ALTER TABLE RENAME found in older versions of SQLite.
    New applications should leave this flag turned off.
    <p>For compability with older [virtual table] implementations,
    this flag is turned on temporarily while the [sqlite3_module.xRename]
    method is being run.  The value of this flag is restore after the 
    [sqlite3_module.xRename] method finishes.
}







|
<
|
>
|
>
|
>
>
|
>
>
>
>
>
>

|







772
773
774
775
776
777
778
779

780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802


Pragma legacy_alter_table {
   <p>^(<b>PRAGMA legacy_alter_table;
       <br>PRAGMA legacy_alter_table = <i>boolean</i></b></p>
    <p>This pragma sets or queries the value of the legacy_alter_table
    flag.)^  ^(When this flag is on, the ALTER TABLE RENAME
    command (for changing the name of a table) works as it did

    in SQLite 3.24.0 ([dateof:3.24.0]) and earlier.)^  More specifically,
    when this flag is on
    the ALTER TABLE RENAME command only rewrites the initial occurrence
    of the table name in its CREATE TABLE statement and in any associated
    CREATE INDEX and CREATE TRIGGER statements.  Other references to the
    table are unmodifed, including:
    <ul>
    <li> References to the table within the bodies of triggers and views.
    <li> References to the table within CHECK constraints in the original
         CREATE TABLE statement.
    <li> References to the table within the WHERE clauses of [partial indexes].
    </ul>
    The default setting for this pragma is OFF, which means that all
    references to the table anywhere in the schema are converted to the new name.
    <p>This pragma is provided as a work-around for older programs that
    contain code that expect the incomplete behavior
    of ALTER TABLE RENAME found in older versions of SQLite.
    New applications should leave this flag turned off.
    <p>For compability with older [virtual table] implementations,
    this flag is turned on temporarily while the [sqlite3_module.xRename]
    method is being run.  The value of this flag is restore after the 
    [sqlite3_module.xRename] method finishes.
}
Changes to pages/vtab.in.
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
that the virtual table will be given a new name. 
If this method returns [SQLITE_OK] then SQLite renames the table.
If this method returns an [error code] then the renaming is prevented.

<p>The xRename method is optional.  If omitted, then the virtual
table may not be renamed using the ALTER TABLE RENAME command.

<p>The [PRAGMA legacy_alter_table=ON] command is run prior to invoking this
method, and the prior value for legacy_alter_table is restored after this
method finishes.  This is necessary for the correct operation of virtual
tables that make use of [shadow tables] where the shadow tables must be
renamed to match the new virtual table name.  If the legacy_alter_format is
off, then the xConnect method will be invoked for the virtual table every
time the xRename method tries to change the name of the shadow table.

<tcl>############################################################# xSavepoint







|
|







1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
that the virtual table will be given a new name. 
If this method returns [SQLITE_OK] then SQLite renames the table.
If this method returns an [error code] then the renaming is prevented.

<p>The xRename method is optional.  If omitted, then the virtual
table may not be renamed using the ALTER TABLE RENAME command.

<p>The [PRAGMA legacy_alter_table] setting is enabled prior to invoking this
method, and the value for legacy_alter_table is restored after this
method finishes.  This is necessary for the correct operation of virtual
tables that make use of [shadow tables] where the shadow tables must be
renamed to match the new virtual table name.  If the legacy_alter_format is
off, then the xConnect method will be invoked for the virtual table every
time the xRename method tries to change the name of the shadow table.

<tcl>############################################################# xSavepoint