drh
92a2824cc6
An improved fix for the dbsqlfuzz-discovered ALWAYS() failure following OOM in
...
sqlite3ExprCollSeq(). This time with a test case (engineered by Dan).
FossilOrigin-Name: 907f7965b335d8d5441f2e386bb190d1f93ffcd45ca98d2d1c621dede491fc5e
2019-10-09 15:37:58 +00:00
drh
efb02281a4
Change sqlite3SelectDup() to always return NULL if an OOM has occurred.
...
FossilOrigin-Name: 01ba4641ab436c6065c8725908fc0913f2abded4ea62e004b7534e0116b9451a
2019-10-09 15:00:37 +00:00
dan
03e025e217
Fix a problem with running ALTER TABLE ADD COLUMN statements within a transaction that writes to one or more virtual tables.
...
FossilOrigin-Name: 31e85fbbc4cfd09a98b4a6dc6624f863816f376c6a4eef1fafc657c8e1abbc36
2019-10-07 18:43:21 +00:00
drh
c5a93d4c85
Validate the type, name, and tbl_name fields of the sqlite_master table when
...
loading the schema, unless writable_schema is engaged.
FossilOrigin-Name: 724f4df9ccc2b683f7091a3f7a8c20ee210f44d7a610cd1b4c49da1c274add08
2019-08-12 00:08:07 +00:00
drh
bdf4cf0b90
Ensure that sqlite3RenameExprUnmap() does an unmap of the result set alias
...
names in subqueries when ALTER TABLE fails because of a syntax error in a
trigger.
FossilOrigin-Name: d3b6f1665f6fb5fc5cf1c0864d779d0b24746ada530f755c7b6ff34766bd2188
2019-06-15 15:21:49 +00:00
drh
2c3f46500f
Mark an unreachable branch with an ALWAYS macro.
...
FossilOrigin-Name: d4755aca4b435eed62b54af84013f7f176d3fa5b7b1c243555d59de5749fcde5
2019-06-11 16:43:58 +00:00
dan
0b277a980a
Have the ALTER TABLE code handle the case where an entire expression that includes a sub-select is excluded from a view, trigger or index.
...
FossilOrigin-Name: f2c8179f3c0b77f10da3f9b0771db4dec30d0bbf0b7f4751ce439bfb08da8f6f
2019-06-11 12:03:10 +00:00
dan
65455fc682
Fix a problem with renaming a table that starts with "sqlite". Fix for ticket [f00d7b65].
...
FossilOrigin-Name: a2ead8aa4517b63cda7bf84464326e9cb5e228224caa603568c0e04ea44e6588
2019-04-19 16:34:22 +00:00
dan
1f3b284b11
Ensure that ALTER TABLE commands open statement transactions. Fix for [596d059a].
...
FossilOrigin-Name: 0f2129f59f7df929106e2af876c2976dea6528c1dc1850d64cddb256f20e121a
2019-03-15 16:17:32 +00:00
dan
0e14e98706
Fix a fairly obscure problem allowing an "ALTER TABLE RENAME col TO ..." statement to modify the schema in such a way as to break a reference within a trigger program.
...
FossilOrigin-Name: 64bec9e6214c6932fab5a3fb8c569ae14cd2d603bd0f8b26104815c3bb9d396a
2019-01-18 16:06:18 +00:00
drh
a1bd5c6aae
Move a local variable declaration into the outermost scope in which it
...
is used. This fixes an ASAN warning.
FossilOrigin-Name: ac3b6021d9437ab1c027850d321f0a3e575b008763d8d515e2347f7d4e7c294b
2019-01-13 00:58:57 +00:00
drh
885eeb676b
Enhance the ALTER TABLE RENAME COLUMN feature so that it works on tables
...
that have redundant UNIQUE and/or PRIMARY KEY constraints.
Fix for ticket [bc8d94f0fbd633fd9a051e3]
FossilOrigin-Name: f09aa3248e2b4a32ff5b5d37084cb2a27445322cb06a3354cef723f4f0b2cd34
2019-01-09 02:02:24 +00:00
dan
397a78d4a1
In defensive mode, do not allow shadow tables to be renamed using ALTER TABLE.
...
FossilOrigin-Name: 23e200da5cfbde0798e67cd9e016e4a1cd73b67981e1af841493fcd123d8f547
2018-12-18 20:31:14 +00:00
drh
974b24896a
Fix a potential NULL pointer dereference that can occur in ALTER TABLE
...
following an OOM. Test case in TH3.
FossilOrigin-Name: ea50815bf80ab0d36891518f209acbcd3d6d8d84529741bffd4e841874c78aff
2018-12-06 01:53:12 +00:00
dan
ea41251eb0
Ensure that ALTER TABLE modifies table and column names embedded in WITH
...
clauses that are part of views and triggers.
FossilOrigin-Name: f44bc7a8b3fac82aa5598e9bdaf65ea4dd3c331cf90c1d5ba26ff1698e92c230
2018-12-05 13:49:04 +00:00
drh
eea8eb6d04
Do not allow direct access to internal-use SQL functions such as
...
sqlite_rename_column() and sqlite3_rename_table() except when the
new SQLITE_TESTCTRL_INTERNAL_FUNCTIONS flag is set.
FossilOrigin-Name: 6e1330545e7b74fe5f1f20751a3425e2788441485fc07fcb7626e448c72027ce
2018-11-26 18:09:15 +00:00
drh
49b269e095
Minor comment enhancement in alter.c. No changes to code.
...
FossilOrigin-Name: 12920bcb99b25e147e1877ee001bc551a743e3530c954fe2b45a18a4eef9eeff
2018-11-26 15:00:25 +00:00
dan
b430701823
When a table is renamed using "ALTER TABLE RENAME TO", update any REFERENCES
...
clauses that refer to the table, unless "PRAGMA legacy_alter_table" is true
and "PRAGMA foreign_keys" is set to false (i.e. so that when "PRAGMA
legacy_alter_table" is set behaviour is still compatible with versions 3.24
and earlier).
FossilOrigin-Name: ae9638e9c0ad0c366f93c88a850f6b4cc86881e9f3f9f1e39574d9d83ddd8a6a
2018-11-09 20:04:05 +00:00
drh
f470c37a2b
Add an ALWAYS on an unreachable branch in the ALTER TABLE logic.
...
FossilOrigin-Name: ebcd4523171f0988ff08e2bf36fb8a0caa40efe7ac7556b4eb206784969b03e4
2018-10-03 18:05:36 +00:00
dan
5351e884aa
Fix a problem with ALTER TABLE commands when the schema features an INSTEAD of
...
trigger that uses NEW.* or OLD.*.
FossilOrigin-Name: c52f457e56eb9d573eb67093731eb231aaf6fd6dbdc397e6f948b82736fbe3ab
2018-10-01 07:04:12 +00:00
drh
42eb070729
Add the "PRAGMA legacy_alter_table=ON" command to enable the pre-3.25.0
...
behavior of ALTER TABLE that does not modify the bodies of triggers or
views or the WHERE clause of a partial index. Enable the legacy behavior
by default when running the xRename method of virtual tables.
FossilOrigin-Name: 7edd26ed27ed1e7eab603058f7d55f2eac45e7bd1908bfa5f32293611883b157
2018-09-20 20:15:02 +00:00
drh
eda079cd2c
Combine the Expr.pTab and Expr.pWin fields into a union named "y". Add a new
...
EP_WinFunc property that is only true if Expr.y.pWin is a valid pointer.
This reduces the size of the Expr object by 8 bytes, reduces the overall
amount of code, and shaves over 1 million cycles off of the speed test.
FossilOrigin-Name: ad130bb86e74e6ce165fdbdce3a19699510f0e62071c1c7923b5a4538d888c7c
2018-09-20 19:02:15 +00:00
dan
34566c4434
By default, make all "ALTER TABLE RENAME" statements executed within a virtual
...
table xRename() method exhibit the legacy behaviour.
FossilOrigin-Name: 71947337e98b90debb13b390119bc2a6b39dd41535151b836071ee327a31e45d
2018-09-20 17:21:21 +00:00
dan
674b894269
Add a PRAGMA that restores the legacy ALTER TABLE RENAME TO behaviour.
...
FossilOrigin-Name: 5acad2e92c11c209bedc6ac8a709595e8070eed028ffc82af61499e5ceaa5e2b
2018-09-20 08:28:01 +00:00
dan
de79e094bc
Minor modification to the fix on this branch to avoid adding extra conditional
...
compilation macros.
FossilOrigin-Name: 4d8be404dab265b51e5a6a95e83be85c22512e19a437191690c7d845c87ff259
2018-09-17 13:38:45 +00:00
drh
16b870d804
Restrict the scope of internal-use functions in alter.c.
...
FossilOrigin-Name: 4396914f8e1a847d86c22fb0b91e7431cf19aa260cbec520af3564248d6897ad
2018-09-12 15:51:56 +00:00
dan
e8ab40d219
Fix an invalid pointer comparison triggered by renaming a table column when
...
there are views with explicit column names in the schema.
FossilOrigin-Name: 572de7e4e33562c72cd90790b267ba389370f21ddcaebc4db609fd76ae9b7ada
2018-09-12 08:51:48 +00:00
drh
3b70045096
Remove a faulty ALWAYS() macro added by check-in [8fa254aa6329bdd0].
...
FossilOrigin-Name: fc47316e9b6b9f4c37cb7d3fe2af3f4dfb900fb5f07945dbf1239152a2d8f836
2018-09-07 19:12:08 +00:00
drh
a488ec9f0a
Add assert() and ALWAYS() to identify two unreachable branches.
...
FossilOrigin-Name: 8fa254aa6329bdd085b8e2c78d8e8a698b418eda8b2d48e0082dd9cd428cef29
2018-09-07 18:52:25 +00:00
dan
d5e6fef2a1
Fix a problem with renaming a non-temp table that has at least one temp
...
trigger and shares its name with a temp table.
FossilOrigin-Name: ceb60bd7e5f2a0a4247bff476fc6468227305467339ae0c24591be9d2b14bdde
2018-09-07 15:50:31 +00:00
dan
202a0274db
Minor fixes for problems revealed by releasetest.tcl.
...
FossilOrigin-Name: 1a8aedc3376b7ae32fa7b2c367eedd483e2629908836efd10ee5bd1fe0784675
2018-09-07 11:51:21 +00:00
dan
1041a6a817
Fix a problem in ALTER TABLE with SQLITE_OMIT_VIRTUALTABLE builds.
...
FossilOrigin-Name: fa835145e63749e06e04bd50ff992afaeae05dcdd1df597d13911f944e62076b
2018-09-06 17:47:09 +00:00
dan
1d85c6bf48
Ensure that the tbl_name column in the sqlite_temp_master table is updated
...
correctly as part of a RENAME TABLE operation.
FossilOrigin-Name: ffecfca511718e39e0003b380d5113755b8a11405a5bd80cc04503d9557f0842
2018-09-06 16:01:37 +00:00
dan
8900a48b92
Avoid comparing pointer values after the object that they point to has been
...
deleted.
FossilOrigin-Name: 2ec7e50cbc0e7a4308d51be3c9416229b187a6a8abdd982c154edc256cd6da1f
2018-09-05 14:36:05 +00:00
dan
dd1a9c8c25
Fix minor code issues in alter.c.
...
FossilOrigin-Name: 18ba35b86f3b9813179b5f8d74e59e4860bfb800f45aabab8d6c0a6d7c97fe74
2018-09-05 08:28:30 +00:00
dan
65372fa963
Improve the error messages emitted by RENAME TABLE.
...
FossilOrigin-Name: 6805b5900df5e6d3329cbad2660875ebe4069efe37b19575f527d153dc0882a1
2018-09-03 20:05:15 +00:00
dan
b87a9a8a5e
Fix a problem with renaming a column in a table that has a temp trigger that
...
references another attached database.
FossilOrigin-Name: 336b8a0923bf65b7a2c35811cb6dec0e262a0b31e534d2a6ab093d2afdb05c1f
2018-09-01 20:23:28 +00:00
drh
5b1da309f7
Fixes for harmless compiler warnings.
...
FossilOrigin-Name: 41b8f38b97bf0d1abcd6de8e940269fc4c51e2bbcf7b2e53e0c8440c58187c33
2018-09-01 20:02:07 +00:00
drh
c753c216c6
Fix some harmless compiler warnings and improve defenses against OOM errors.
...
FossilOrigin-Name: 2e2cf992f5d6cae2030c3c03b0eb98af3b130e86a719b991e41380138751f615
2018-09-01 16:55:36 +00:00
dan
0923650365
Have "ALTER TABLE ADD COLUMN" reload the entire db schema, as "RENAME COLUMN"
...
and "RENAME TABLE" do.
FossilOrigin-Name: 8d89ddc1a628e983b0fbd929c9c9daac86ee23d18f8dd2709c971012389395c6
2018-09-01 16:05:50 +00:00
drh
010f8ee2fb
Merge fixes from the alter-table-rename-column branch that occurred after
...
this branch separated from that one.
FossilOrigin-Name: 22e785aa2bbce4ae0852bc3d127d4b12222a192eb6e3ee874bf8e5c8582d05f3
2018-09-01 15:55:44 +00:00
dan
141e119a17
Ensure b-tree mutexes are always held when sqlite3FindTable() is called. Do
...
not invoke the authorizer callback when parsing schema items as part of ALTER
TABLE commands. Fix test script issues.
FossilOrigin-Name: eac2aa7dce577f1998cc2078dd8ac384070f8acf1ceb565999a5cf719092024e
2018-08-31 18:23:53 +00:00
dan
9d324823a8
Test the schema after renaming a table. Ensure that temp database triggers and
...
views are updated when renaming a column.
FossilOrigin-Name: f3c27d916d4837f8fc3dd812bd004535f04c7a53bd2a0a2419613275f48bec76
2018-08-30 20:03:44 +00:00
dan
0ccda96867
Fix an ALTER TABLE problem with processing temp schema views and triggers.
...
FossilOrigin-Name: 72cfb1be29971d91a164f1d4f20cb054de68960a0bd547630bcd1160565971c5
2018-08-30 16:26:48 +00:00
dan
c9461ecc28
Extend RENAME TABLE to edit triggers and views. Still buggy.
...
FossilOrigin-Name: 01308bae3acf33f78b5bb90892085eab340df093aafc17e6ccf6a7d6cf324897
2018-08-29 21:00:16 +00:00
drh
0d019b9243
Invoke the authorizer for ALTER TABLE RENAME COLUMN.
...
FossilOrigin-Name: fc293bcb3402f049fb9e22aacfb4fdcd13f8609edf29c97d6cb95ce351363873
2018-08-25 16:14:46 +00:00
drh
da76adc085
The implementation of sqlite_rename_column() must be holding the
...
schema mutexes.
FossilOrigin-Name: f0eed21d4e2e1f2c8e680a510a283ac21156c9766efec5b80a362a040424bce7
2018-08-25 02:04:05 +00:00
dan
aa42e9816b
Fix a problem by renaming a column when the schema contains an trigger program
...
featuring an UPSERT that uses an "excluded.*" reference to a different table.
FossilOrigin-Name: 83d5f5abce6be2f6d342a6fc68839289400d7bcb80eaa38194789142c93a80c3
2018-08-24 20:20:33 +00:00
dan
85a9d508df
Fix a problem with renaming a column that occurs as an "excluded.colname"
...
construction in an UPSERT that is part of a trigger program.
FossilOrigin-Name: bb2f7234968157b605522dea8e115d8772ab4234147894089d6e48fedf5d6a5d
2018-08-24 20:10:22 +00:00
dan
0d5fa6b979
After modifying and reparsing the schema as part of an ALTER TABLE RENAME
...
COLUMN, check that no new schema errors have been introduced (e.g. ambiguous
column names in views) before committing the operation.
FossilOrigin-Name: a0e06d2c5e3abb3f300491e7651bb177a436899efd4506de9239359096b6a9e7
2018-08-24 17:55:49 +00:00