aboutsummaryrefslogtreecommitdiff
path: root/src/resolve.c
Commit message (Collapse)AuthorAge
* Fix PRAGMA trusted_schema=OFF and similar so that it restricts the kindsdrh11 days
| | | | | | | | | of functions in CHECK constraints that the documentation says it does. It was letting through some function that it ought not have. This is a defect in [5720924cb07766cd]. See [forum:/forumpost/3fa9d44c0b381342|forum thread 2025-05-08T08:50Z]. Additional test cases will be added separately. FossilOrigin-Name: 25920beebf71ebc9a1bb9f56932280c9e03390f26fe9da2258f950979b238ce6
* Internal doc typo fix. No code changes.stephan12 days
| | | FossilOrigin-Name: ac2aa39f7e3ae7ac921fac6566186939a1282f80ced5b3e3d5006a77ecf583ff
* Make use of the flexible-array feature of C99, when available, to try todrh2025-03-14
| | | | | | pacify -fsanitize=strict-bounds. This check-in fixes the core. There is more yet to do in FTS3, RTREE, and in FTS5. FossilOrigin-Name: 6fd6b32d06bd6a705e5140cd613af823b8183a6f6a9ceeeedfcf5e8b50821d68
* Use the sqlite3ColumnIndex() routine to look up a column in a table, ratherdrh2025-02-08
| | | | | | than using a custom loop. Performance improvement, size reduction, and complexity decrease. FossilOrigin-Name: 351dbbc2bf0b23efdc625ddaa5dc2239cf2990addf071a04bd41612b341de8c8
* Allow expressions with subtypes to be read from indexes unless they are ↵dan2024-10-05
| | | | | being used as direct or indirect parameters to SQLITE_SUBTYPE functions. FossilOrigin-Name: aa440e78e9004c7ca3e03beaf264f54d0070ad7298a3c96ca097d8b35c872e5f
* Remove an ALWAYS() that can sometimes be false, with wildly incorrect SQLdrh2024-09-24
| | | | | inputs. dbsqlfuzz 707afcf73930de2624cdeca0ad1f0deea982dfea FossilOrigin-Name: 766cf5535b9f51decd88c1736b988def929a90f68eb6a52bcaa21bb321586a08
* New assert()s to help verify union access. No logic changes. Testing anddrh2024-09-20
| | | | | validation code only. FossilOrigin-Name: b7b64c53f5d7f6b405ee3f1f1be1d84230aa79db5a502c8ad78d3e524f4384fb
* Remove a term from an assert() that is no longer relevant.drh2024-08-24
| | | FossilOrigin-Name: 8b4766252b80075354a6b1406c5430fe999a6490aa3e079893fcc682d88734f7
* Avoid a stack overflow that could be caused by a recursively defined ↵dan2024-08-24
| | | | | WINDOW() with a strategically embedded error. FossilOrigin-Name: bada54bd6bf54190e40aa721b77081015957d204c7b6a9fdbe8c67bcf20798f8
* Refactor the SrcItem object so that information about subqueries is storeddrh2024-08-19
| | | | | | | | | in a separately allocated Subquery object. This reduces the memory requirements for SrcItem and makes the code run faster. It also provides an expansion path for subquery processing that does not burden simple queries. The current checking mostly works, but there are still issues that need to be tracked down and fixed. FossilOrigin-Name: 8ff5dda8448d7e1a533d7f27db2573ce68fa9956b9d9847ced45e83c1f06bab0
* Give unique names to fields in the SrcItem object, to facilitate analysis ofdrh2024-08-17
| | | | | how those fields are used using "grep". FossilOrigin-Name: 9f5aeef3cbc2c95267c8f7bf60d5c66971a76789669fb0e8f853273ff6f616f2
* Fix the internal routine sqlite3ResolveExprListNames() so that it returnsdrh2024-08-09
| | | | | | | SQLITE_OK or SQLITE_ERROR instead of WRC_Continue or WRC_Abort. Without this fix, some times of obscure syntax errors end up returning SQLITE_INTERNAL rather than SQLITE_ERROR. FossilOrigin-Name: 9052187efd1f78abd9b285ac94269a3ba4d65b6aa74c9fa34002ee0628c83919
* Better optimize queries that use parameters in the LIMIT clause.drh2024-06-06
| | | FossilOrigin-Name: e58cb304d1e0ec6e30260a165aaccc2cf096ce6c999efb06683c4ef600ee12ef
* Fix a very obscure issue where the name resolver could get confused if ↵dan2024-06-05
| | | | | aliases like "sqlite_schema" or "sqlite_master" were used in a query involving the sqlite_temp_schema table. FossilOrigin-Name: a096eb7554952f8137c6e9330c328164719fb27e958787fbd503bcd1364e6ae4
* Fix the definition of sqlite3_vtab_distinct() such that return codes 2 anddrh2024-05-18
| | | | | | | 3 mean that all rows must be distinct over "colUsed" which is a superset of "aOrderBy". Also, disallow return codes 2 and 3 if the rowid of the virtual table is accessed. FossilOrigin-Name: 922731ce98c0ce7837784ff7966049e59fa73da2aa04abf3506503b6fc4aa048
* Fix a case where an error in the ORDER BY clause of an aggregate function ↵dan2024-05-15
| | | | | that is part of a trigger body might cause an assert() to fail in an ALTER TABLE command. FossilOrigin-Name: b79a8be37b44c1eff7d00f7af7cd9d0e13614ce5961bb88ddb9ec63f6a846c78
* Avoid an assert failure accessible only when internal testing features are ↵dan2024-05-02
| | | | | enabled. dbsqlfuzz crash-66abacda6bca6bd531e25595e8c8068e2c710326.txt. FossilOrigin-Name: fbc446daac761dd1b66a85c9b61e1d5af194a8fd665600c43a874da38cc6ec10
* Add comments linking the assert() added in [cef4d9e3ba586735] to the placesdrh2024-04-24
| | | | | where the precondition that the assert() tests are actually required. FossilOrigin-Name: 6f0e7e195275aeb4aefd9da20348af35e3ef7f0a6b2768a34824daeace16eff1
* Ensure that temporary SrcItem objects created by trigger processing havedrh2024-04-24
| | | | | | either SrcItem.zName or SrcItem.pSelect defined. Every SrcItem should have one or the other. FossilOrigin-Name: cef4d9e3ba586735598f03eb5e8f29072c9e6f62b0d34ddd2fb3ed1795f6e21c
* Merge trunk testing enhancements into the pushdown-subquery branch.drh2024-04-07
|\ | | | | FossilOrigin-Name: 287ff24b26a512ff7648679767e68244f6eef95df6a49c46ed1f2594030ed523
| * If SQLITE_ALLOW_ROWID_IN_VIEW is set to 2, then all rowids for views returndrh2024-04-07
| | | | | | | | | | a value of NULL. FossilOrigin-Name: 0a53dde21403aa6de11c5085c16def3f95046c5629daf2675b075e4d6683ef94
* | Generalize pushdown to allow any uncorrelated subquery to be pushed down.drh2024-04-06
|/ | | FossilOrigin-Name: 87c45fb0d5f5ca5d6d1ad27bef83f294231d17d94299e1997364a7975b423e38
* Return the error "ambiguous column name: rowid", instead of "no such column: ↵drh2024-03-19
|\ | | | | | | | | rowid", when a "rowid" reference is ambiguous. FossilOrigin-Name: 0615bdae2dfc70c7e0416a28e89ffde31fa44ed4b3dac46e5ef20eed0d89e58c
| * Return the error "ambiguous column name: rowid", instead of "no such column: ↵dan2024-03-19
| | | | | | | | | | rowid", when a "rowid" reference is ambiguous. FossilOrigin-Name: 021f34fcfed41b607be8169bbda59aef93f130108d944f4741b46e8e345b2bbb
* | In the name resolver when SQLITE_ALLOW_ROWID_IN_INDEX is enabled, if theredrh2024-03-19
|/ | | | | | are multiple views that might resolve to the "rowid" but only one real table, then use that one real table and ignore the views. FossilOrigin-Name: 8fcea4cdfc89dd78eca5e7f62aa31aff0e296f41e79349d3af1cc3a2bc4d77c6
* The NOT NULL strength reduction optimization from [de9c86c9e4cdb34f] shoulddrh2024-03-08
| | | | | | | | be applied to the WHERE clause only. Otherwise, the operand of the IS NULL or IS NOT NULL operator might be a reference to a bare column of an aggregate table, and we can't tell if it is NULL or not based only on its NOT NULL attribute. [forum:/forumpost/440f2a2f17|Forum post 440f2a2f17]. FossilOrigin-Name: 51704feae224eff601db5607f8651da11b3c2ed8a58ffe5b6ee8260cab50695b
* If a term of an ORDER BY or GROUP BY contains an aggregate function or column,drh2024-02-11
| | | | | | | then it is not an alias that needs to be resolved, so don't try to. This fixes a harmless assertion found by dbsqlfuzz. This yet another problem that orginated at check-in [6e6b3729e0549de0]. FossilOrigin-Name: d4ec2a5d2297cd9ead0a8768dcf003ea76c74d8d68d88c40f62363f484a4a4d3
* Simplification of the error reporting logic.drh2024-01-22
| | | FossilOrigin-Name: 59eb9d29e796886db17a578b64e75fd2797aebf969cbeeda70ecf2fda378c98f
* Improved error message when a double-quoted string is used and it seems likelydrh2024-01-22
| | | | | that the user wanted a single-quoted string literal. FossilOrigin-Name: 0a834bd81122b6e9c34c8253f9e45d53dab3274be28df60968366fa42237617b
* When unable to resolve an identifier, change the Expr node into TK_NULLdrh2023-12-19
| | | | | | rather than TK_COLUMN, to prevent any downstream misuse of the non-existent column. dbsqlfuzz 71869261db80a95e4733afa10ff5724bf3c78592. FossilOrigin-Name: d2e6117e4f97ab98b01deb5fcad5520f8181d00bed8d904d34963c01d73df857
* Avoid invoking sqlite3ExprColUsage() on an unresolve column reference.drh2023-12-13
| | | | | dbsqlfuzz fc34aa62df4de103705d11b807074687ffafbda5. FossilOrigin-Name: ac9314c0e335694b48c613145f5397247bb88c51806cd0dc3ed4ec306db4bbad
* In the previous check-in, use a u32 instead of an int, to make it easier todrh2023-11-02
| | | | | prove that the integer will never overflow. FossilOrigin-Name: 51002079e0b499e116415189a913a238e95ed9766a8af9d042928f4263861a87
* Fix a spurious "misuse of aggregate function" error that could occur when an ↵dan2023-11-02
| | | | | aggregate function was used within the FROM clause of a sub-select of the select that owns the aggregate. e.g. "SELECT (SELECT x FROM (SELECT sum(t1.a) AS x)) FROM t1". [forum:/forumpost/c9970a37ed | Forum post c9970a37ed]. FossilOrigin-Name: 4470f657d2069972d02a00983252dec1f814d90c0d8d0906e320e955111e8c11
* Fix PRAGMA integrity_check so that it does not raise an error if thedrh2023-10-20
| | | | | | schema contains a CREATE VIRTUAL TABLE that does not have its module loaded. FossilOrigin-Name: 5cb61c6788d7c0170b587e4667ee57d588c991a9901951762e33b97c6a135a82
* Make sure all terms of the ORDER BY within an aggregate go through aggregatedrh2023-10-18
| | | | | analysis. Do not attach an aggregate ORDER BY to a window function. FossilOrigin-Name: 16f3805514a741405f70e0ee3b5a6b67720bc75719372e82daa4136fe411ea2b
* Basic error checking. Resolve symbols in the aggregate ORDER BY expressions.drh2023-10-18
| | | FossilOrigin-Name: c83a53a574d312130d1238c05ffa449d8bed2535d5ef5b5d9cf02f894494cca4
* Add a NEVER() to an unreachable branch.drh2023-09-16
| | | FossilOrigin-Name: 6b6eb38979d68c06e382620c8813d6b67a3de02c4a7a029c84f924b9a2e380c6
* Further tests and assert() statements for the change on this branch.dan2023-09-16
| | | FossilOrigin-Name: 1c202d540ac362bfc747a9f8472e83c9d7614e38467f8b48787a669fb34664ba
* Fix resolution of unqualified "rowid" identifiers in queries with nested joins.dan2023-09-15
| | | FossilOrigin-Name: bbcbd3d537d6790373d97f59386b8ce7fa2177db572af0f1babe058a76e25cc3
* Allow expressions like "<tbl>.rowid" to refer to implicit rowid columns of ↵dan2023-09-15
| | | | | tables in nested FROM clauses. FossilOrigin-Name: 59a1bbc69f5dbb33418fa4b383393fb13a46bc1e531577da8ad54ae2fad5a10e
* Avoid unnecessary NULL pointer checks on calls to sqlite3WalkExpr().drh2023-06-19
| | | FossilOrigin-Name: 73d86a12fb068456a884c030fddd87020d6ec9d56376de541cf082b2104174d3
* Add a C-source spell-checking facility. make misspell (on Nix)larrybr2023-06-07
| | | FossilOrigin-Name: 26c1bb4bd9e9f56613c3aa87407a7f562fd4ebde5bfd6dece02078001d9a45f8
* Add ALWAYS() on a branch this is always true now due to [84417bbd144b2197].drh2023-03-21
| | | FossilOrigin-Name: badf7d0e3cfa6efaff4b132cb4ecca79a16e73197c5e275db14ccb5ff938276d
* Disallow the one-pass optimization for DELETE if the WHERE clause containsdrh2023-03-15
| | | | | | | | a subquery. Fix for the problem reported by [forum:/forumpost/e61252062c9d286d|forum post e61252062c9d286d]. This fix is more restrictive than necessary. It could be relaxed if the subquery does not involve the table that is the subject of the DELETE. FossilOrigin-Name: 73f0036f045bf37193b6e87ae45b578c5831614c530488257c69666178da3aa5
* When it is known when preparing a statement that X cannot be NULL, transform ↵dan2023-03-03
| | | | | the expression (X IS NULL) to integer value 1 instead of 'true'. This is because under some circumstances, "Y IS TRUE" may not be equivalent to "Y IS 1". FossilOrigin-Name: cc4bb05b3653e9502b95ea6fe0bfb77feebc11285b66e1dde4c7b945928efbf1
* Improved and simplified logic for resolving the various aliases of the schemadrh2023-02-02
| | | | | table. FossilOrigin-Name: 5c19491c36b9e2128430e4f153bdef48c3f7b6541d44f36044e8fc2921ecc830
* Resolve all possible aliases and variations of the schema table names.drh2023-02-02
| | | FossilOrigin-Name: e7a0112b235d97cb68c92b967bf2218b90258c243ec2b638aaac142392873126
* In expression nodes of type REGISTER with sub-type COLUMN, ensure that thedrh2023-01-13
| | | | | | | iColumn field is set correctly, as otherwise the "IS NULL" operator might be incorrectly optimized. Fix for the problem described by [forum:/forumpost/d010a26798915b53|forum post d010a26798915b53]. FossilOrigin-Name: 0819a1869a39d54a405259ea323365506a182962a02affdef16a03446005da64
* Make use of the sqlite3ExprDeferredDelete() interface in the previousdrh2022-07-20
| | | | | check-in, and in another place where it might be helpful. FossilOrigin-Name: 22f90e9683d5cd6619ccdb06a02e9dde9f4b7457391c0dbb4c3216c22fc0db47
* Simplify the logic that converts the "1" expression in "ORDER BY 1" into adrh2022-07-20
| | | | | copy of the expression that defines the first output column. FossilOrigin-Name: e1f1cfe7f4387b60443bd31742e2f49db1a2d0443200318a898ba0da216619be