1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Fix handling of columns with names that are SQL keywords in the ".expert" command.

FossilOrigin-Name: 5e1b8221c385deb04a3ff5aafb2e9fc55aecc6ffc68328674e3afe56c4273e29
This commit is contained in:
dan
2022-08-10 15:29:21 +00:00
parent 626bcc88dd
commit 217635f709
4 changed files with 23 additions and 9 deletions

View File

@ -391,6 +391,16 @@ do_setup_rec_test $tn.18.1 {
SEARCH SomeObject USING COVERING INDEX SomeObject_idx_00000078 (x=?)
}
do_setup_rec_test $tn.19.0 {
CREATE TABLE t1("index");
} {
SELECT * FROM t1 ORDER BY "index";
} {
CREATE INDEX t1_idx_01a7214e ON t1('index');
SCAN t1 USING COVERING INDEX t1_idx_01a7214e
}
}
proc do_candidates_test {tn sql res} {

View File

@ -820,6 +820,10 @@ static char *idxAppendText(int *pRc, char *zIn, const char *zFmt, ...){
*/
static int idxIdentifierRequiresQuotes(const char *zId){
int i;
int nId = STRLEN(zId);
if( sqlite3_keyword_check(zId, nId) ) return 1;
for(i=0; zId[i]; i++){
if( !(zId[i]=='_')
&& !(zId[i]>='0' && zId[i]<='9')