Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Always resolve symbols in all ORDER BY clauses of a compound-SELECT, even illegal ORDER BY clauses. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
6c39ef73d5899eabdb46db50c2b00c2d |
User & Date: | drh 2015-04-17 18:52:37.624 |
Context
2015-04-17
| ||
19:41 | In the expression-tree comparison routine, do not compiler Expr.iColumn and Expr.iTable for TK_STRING expressions. (check-in: b67bb16c72 user: drh tags: trunk) | |
18:52 | Always resolve symbols in all ORDER BY clauses of a compound-SELECT, even illegal ORDER BY clauses. (check-in: 6c39ef73d5 user: drh tags: trunk) | |
18:22 | Remove unnecessary parser error count increments. Let the sqlite3ErrorMsg() take care of doing that. (check-in: 3f3b0f683a user: drh tags: trunk) | |
Changes
Changes to src/resolve.c.
︙ | ︙ | |||
1296 1297 1298 1299 1300 1301 1302 1303 | pSub->pOrderBy = 0; } /* Process the ORDER BY clause for singleton SELECT statements. ** The ORDER BY clause for compounds SELECT statements is handled ** below, after all of the result-sets for all of the elements of ** the compound have been resolved. */ | > > > > > > | > | 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 | pSub->pOrderBy = 0; } /* Process the ORDER BY clause for singleton SELECT statements. ** The ORDER BY clause for compounds SELECT statements is handled ** below, after all of the result-sets for all of the elements of ** the compound have been resolved. ** ** If there is an ORDER BY clause on a term of a compound-select other ** than the right-most term, then that is a syntax error. But the error ** is not detected until much later, and so we need to go ahead and ** resolve those symbols on the incorrect ORDER BY for consistency. */ if( isCompound<=nCompound /* Defer right-most ORDER BY of a compound */ && resolveOrderGroupBy(&sNC, p, p->pOrderBy, "ORDER") ){ return WRC_Abort; } if( db->mallocFailed ){ return WRC_Abort; } /* Resolve the GROUP BY clause. At the same time, make sure |
︙ | ︙ |
Changes to test/select4.test.
︙ | ︙ | |||
115 116 117 118 119 120 121 | UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY log; }} msg] lappend v $msg } {1 {ORDER BY clause should come after UNION ALL not before}} do_catchsql_test select4-1.4 { | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | UNION ALL SELECT n FROM t1 WHERE log=3 ORDER BY log; }} msg] lappend v $msg } {1 {ORDER BY clause should come after UNION ALL not before}} do_catchsql_test select4-1.4 { SELECT (VALUES(0) INTERSECT SELECT(0) UNION SELECT(0) ORDER BY 1 UNION SELECT 0 UNION SELECT 0 ORDER BY 1); } {1 {ORDER BY clause should come after UNION not before}} # Union operator # do_test select4-2.1 { execsql { |
︙ | ︙ | |||
146 147 148 149 150 151 152 153 154 155 156 157 158 159 | do_test select4-2.3 { set v [catch {execsql { SELECT DISTINCT log FROM t1 ORDER BY log UNION SELECT n FROM t1 WHERE log=3 ORDER BY log; }} msg] lappend v $msg } {1 {ORDER BY clause should come after UNION not before}} # Except operator # do_test select4-3.1.1 { execsql { | > > > > > > | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | do_test select4-2.3 { set v [catch {execsql { SELECT DISTINCT log FROM t1 ORDER BY log UNION SELECT n FROM t1 WHERE log=3 ORDER BY log; }} msg] lappend v $msg } {1 {ORDER BY clause should come after UNION not before}} do_test select4-2.4 { set v [catch {execsql { SELECT 0 ORDER BY (SELECT 0) UNION SELECT 0; }} msg] lappend v $msg } {1 {ORDER BY clause should come after UNION not before}} # Except operator # do_test select4-3.1.1 { execsql { |
︙ | ︙ |