Commit Graph

40 Commits

Author SHA1 Message Date
dan
dcc121999c Avoid expanding integer values in columns with real affinity to the full 8-byte representation when editing records as part of a DROP COLUMN command.
FossilOrigin-Name: a49296de0061931badaf3db6b965131a78b1c6c21b1eeb62815ea7adf767d0b3
2024-03-26 11:14:52 +00:00
dan
26a3ef7557 Fix a problem with ALTER TABLE and correlated multi-row VALUES clauses.
FossilOrigin-Name: d543c829ef74dbd64105bd757ca660e4f02e9ce562be4f1688a701fa535351c4
2024-03-14 19:31:06 +00:00
dan
4209d553e7 Fix further issues with ALTER TABLE and triggers that contain UPDATE..FROM statements.
FossilOrigin-Name: 53fbc269ddbabc4a97d297e881e5f9cd2bfbcd24af4af1b7cf9db412a3a51813
2022-05-27 15:04:43 +00:00
dan
cbde37d8e4 Fix a problem in ALTER TABLE with handling "table.*" expressions within SELECT statements in triggers.
FossilOrigin-Name: 24755fd0657252e49793bb1fe906973a2dd84a1bde03bea9a762de36cc96c2d2
2022-04-19 20:47:18 +00:00
dan
0abb7ec36c Fix a typo in altertab3.test.
FossilOrigin-Name: 18d38b13104a9c3367ec205bfa17fbdc3d792ba68a369b1c6f046096ef6cc581
2021-09-29 19:18:53 +00:00
dan
ab632bc97e Fix another problem with ALTER TABLE and vector UPDATE statements within triggers.
FossilOrigin-Name: a0df216f7c3f8963efba0b1ffee65d6a63309d846ffdcf2d2932cb4f1d4967b7
2021-09-29 18:33:26 +00:00
dan
a7f7c1c4af Fix a potential ALTER TABLE problem with expressions like ( (<sub-select>) IN () ).
FossilOrigin-Name: df0d7e36dbf98ab5405d8366ce92fb85176d4388b47a57b0ca1aa1ba6ae5212e
2021-09-28 10:44:54 +00:00
dan
f380c3f13c Fix a problem caused by using an SQL variable in an OVER clause within a trigger program.
FossilOrigin-Name: 4f676466e60ee2a420b7b2deace76f3a733ce1af278347428285715d9c67f022
2021-01-21 15:40:52 +00:00
drh
6d5ab2a1d6 Fix an another OSS-Fuzz discovered assertion fault due to ALTER TABLE and
strange triggers.

FossilOrigin-Name: 6646d7898ca1d2f71ec906d9613fbfc5c59c6cf05f053529e6e32ab826d1cb78
2020-11-02 00:40:05 +00:00
dan
7a39faecc2 Update the ALTER TABLE command to correctly handle UPDATE ... FROM statements within trigger programs.
FossilOrigin-Name: 3e6af890406b58da1c4aebec4d483be7ab0fdb589ef7a4c4e987d6bde18d6b97
2020-10-31 16:33:01 +00:00
dan
e7877b2d6b Support UPDATE...FROM statements in trigger programs.
FossilOrigin-Name: 4f6d8d0ebf40029218a1d3b05ea657c0c5953b01c6f0b6a628465aa44c67e7f3
2020-07-14 19:51:01 +00:00
dan
2b6e670f73 In ALTER TABLE, rename columns and tables in expressions that are optimized out by the "AND 0" optimization. Doing this also fixes an otherwise harmless assert() failure.
FossilOrigin-Name: a9e0354c992b0287608ddd18fd35fe7e6102a8f293d6e6e1b3488644bcda8168
2019-12-30 06:55:31 +00:00
dan
a6c1a71cde Do not attempt to unwind the WITH stack in the Parse object following an error. This fixes a separate case to [de6e6d68].
FossilOrigin-Name: d29edef93451cc67a5d69c1cce1b1832d9ca8fff1f600afdd51338b74d077b92
2019-12-27 20:54:42 +00:00
dan
394aa710f2 Fix a potential problem with ALTER TABLE commands on schemas that contains a triggers or view featuring a sub-query that uses an ON clause with a join that is not a LEFT JOIN.
FossilOrigin-Name: 365dd8b663d5a28af33556b2b3820c6b5482114ef741a1d82b55c6e154f3043a
2019-12-20 14:18:29 +00:00
drh
2bc5cf9ae9 Add a NEVER() to the ALTER TABLE fix in check-in [1d2e53a39b87e364]
FossilOrigin-Name: c7309ed3c7588c7e51e09418bf5cfd4611539b44c39cef9ed4ae0e385bae7625
2019-12-09 19:29:10 +00:00
dan
38096961c7 Avoid infinite recursion in the ALTER TABLE code when a view contains an unused CTE that references, directly or indirectly, the view itself.
FossilOrigin-Name: 1d2e53a39b87e364685e21de137655b6eee725e4c6d27fc90865072d7c5892b5
2019-12-09 08:13:43 +00:00
dan
e6dc1e5b70 Fix a problem in ALTER TABLE that could occur if an index, view or trigger in the schema features an expression of the form ((SELECT ...) IN ()) where the SELECT statement uses a CTE.
FossilOrigin-Name: 7e5ad8e0ab7ee91a5ccb19a9654d6a036233f74d2fdc45f7315feb3d9d035fd4
2019-12-05 14:31:43 +00:00
drh
d63b69b8a2 Ensure that an ALWAYS() in the rename logic really is always true, even
for faulty inputs.

FossilOrigin-Name: 54410f0e7710542d5159d0449898598d2b7f7676bfd993644ca47da1bf1fcdac
2019-12-04 15:08:58 +00:00
dan
8f4076223d Fix an assert() failure that could occur in ALTER TABLE code when the schema contains a view that uses a CTE.
FossilOrigin-Name: 75b04a4b0d2e65bfcd02cf4e0b6d8f1954957c590814a9b8f9a9ee2adc2ec022
2019-12-04 14:26:38 +00:00
dan
9930cfe878 Fix a problem in fts3 causing it to report corruption if a doclist contains consectutive rowid entries that differ by more than 2^63.
FossilOrigin-Name: 0b0a3048f9df88bbc8979f2ac5247bee7d7bc1e585faca252610d2fcbe36d51d
2019-10-28 13:54:59 +00:00
drh
175b8f06f7 Remove support for STAT3. The sqlite_stat3 tables are ignored, if they
exist.  STAT4 continues to work as it always has, and as it is a superset of
STAT3 is the recommended replacement.

FossilOrigin-Name: 1e17ea2fd1df4ad49138c787c8fe3207dd0c25c93f9001d52a9b69f8c12e841c
2019-08-08 15:24:17 +00:00
dan
72d1eac673 Fix a problem with renaming a table when a view or trigger within the schema uses a FILTER with an aggregate function that is not currently registered with the database.
FossilOrigin-Name: 2ac0e42f8ab7a9184c2a2efd13bd50ab51bc01f9f34e9e63591fd18db02dff54
2019-08-05 13:19:25 +00:00
dan
71f059c880 Fix a problem in ALTER TABLE triggered by views or triggers that include the construction "ORDER BY true" or "ORDER BY false".
FossilOrigin-Name: 8168021f9ab5fb8b4888257963c9ec68fd1dfeedaf6bba4b8e07438001d0be0f
2019-08-01 10:58:46 +00:00
dan
1e60261cfb Fix a problem with renaming tables when the schema contains an invocation of a currently unregistered aggregate with a FILTER clause.
FossilOrigin-Name: bd37ce3fb8dee8d538f6afc0bfc13cdc3ebdd504e6461f0130c6ecc8af585f68
2019-07-22 11:38:43 +00:00
dan
9bf022d57c Fix a problem with renaming a table when the schema contains an invocation of a window function that is not currently registered.
FossilOrigin-Name: ff290feb97f689cf6ce4162d6aa36f9f9dcf1bff3096847d53a85f39f728d2de
2019-07-19 14:32:42 +00:00
dan
750c6ba5e5 Fix a problem with renaming tables when the schema contains WINDOW definitions with (illegal) non-numeric expressions as part of a PRECEDING or FOLLOWING clause.
FossilOrigin-Name: 348e7f193a963390a0595183d603541f85c5d1a911c98ed2e06599691ffe98f5
2019-07-19 11:20:42 +00:00
dan
a1ac03590b Fix a faulty assert() in walker.c that could fail when processing an ALTER TABLE statement on a schema containing invalid table references that are part of a WINDOW definition.
FossilOrigin-Name: ee076c28d8ee0f5b099cdef83ae6cea6ef5aa209ab528d7c49949dd653ce019c
2019-07-19 10:31:29 +00:00
dan
44c99ecf9c Add extra test case for one of the problems fixed by the previous commit.
FossilOrigin-Name: 0bbceebb126c94b5159079a341fa16e8424b7f2f6b9364561516964e871fb6e0
2019-06-15 15:27:37 +00:00
drh
4245e0456d Fix a minor error in a test script, and harmless compiler warnings in the CLI code.
FossilOrigin-Name: eaa34626e497d3af132dd8f13eddbbda89365d369ed43212a5f788175b3d6198
2019-06-13 13:52:46 +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
e4a9e4d0e5 Have ALTER TABLE commands ignore the lhs of "expr IN ()" and "expr NOT IN ()" expressions, just as other queries do. Fix for [533010b8ca].
FossilOrigin-Name: 71643deb6bbad4b4a511bfd43b32245b50a555b508b90f33adf0656ae53292c6
2019-06-10 19:17:37 +00:00
dan
e20a894a34 Handle renaming a column or table when the schema contains a (meaningless) index on the constant expression ('text' IN ()) or ('text' NOT IN()).
FossilOrigin-Name: 567b13093956185b5d5e971b81ba4788fd9d26c03688f643b380f0f1c1a94da0
2019-06-10 15:34:16 +00:00
dan
490e6f2506 Fix a stack overflow that could occur when renaming a table that has a trigger containing a window function invocation that itself contains a specific syntax error.
FossilOrigin-Name: c621fc668c6538f9f5bdac204f012c64998679a61aa8e224d212503820224c09
2019-04-29 11:27:58 +00:00
dan
150dfbd2c8 Fix minor problems in tcl test scripts.
FossilOrigin-Name: 56b664185e3e56ad22e0c16a5b946fc8204d4d33221b6b4269d6d650dfd9969c
2019-04-12 12:10:03 +00:00
dan
2381f6d7e5 Fix a potential dangling pointer deference in an ALTER TABLE run on a schema that contains constructs of the form "PRIMARY KEY(column COLLATE collation)".
FossilOrigin-Name: b9e2393cf201e3fc24519c5ae65d0a5953147d78884e53d44a7958747b4a7e13
2019-03-20 16:58:21 +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
8cd2e4ae03 Build and test fixes for SQLITE_OMIT_WINDOWFUNC builds.
FossilOrigin-Name: 8824115a9776e876a3677f0cb479e311ee65584d43872b37766a146afec72d8f
2019-02-11 11:34:01 +00:00
dan
f467744d5f Fix a problem with running ALTER TABLE on a schema that contains expressions of the type "col IN ()" (empty set on RHS of IN operator).
FossilOrigin-Name: 2d9cd06715092c312c8c0ec392696a0e90ed090b074e2082e0b830f1399aa941
2019-01-24 16:27:10 +00:00
dan
a5f9f42a0e Fix a problem with renaming a table within a schema that contains a composite query that uses a column alias as an ORDER BY term.
FossilOrigin-Name: 2ca6b8f84ec07e313aa4e1c0894827401b418dcc4221e9c54c384f1c3893952a
2019-01-23 19:50:46 +00:00
dan
d99950310f Fix problems with sub-selects in WINDOW definitions. Also rename-column operations when the column being renamed appears in a WINDOW definition that is part of a VIEW or TRIGGER.
FossilOrigin-Name: 0387cb3add992b2028efe4f2100188d8f9fdfdcb233329857aa4b46a293cfc97
2019-01-23 16:59:24 +00:00