aboutsummaryrefslogtreecommitdiff
path: root/src/resolve.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2018-12-06 16:11:14 +0000
committerdrh <drh@noemail.net>2018-12-06 16:11:14 +0000
commitec8fc62c42902496b3955c7447f865a6142edfeb (patch)
tree29374363cfbead85e83982f412f73c132332f706 /src/resolve.c
parent3e2d47d49fbf897f28971845671d3fd6aa3cc5b3 (diff)
downloadsqlite-ec8fc62c42902496b3955c7447f865a6142edfeb.tar.gz
sqlite-ec8fc62c42902496b3955c7447f865a6142edfeb.zip
Issue a warning whenever a double-quoted string literal is used.
FossilOrigin-Name: ac9ad5043026b30394812457e1535df2759aea0d4510029561e92e386672796f
Diffstat (limited to 'src/resolve.c')
-rw-r--r--src/resolve.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/resolve.c b/src/resolve.c
index effbe646f..39c2039f5 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -474,6 +474,22 @@ static int lookupName(
if( cnt==0 && zTab==0 ){
assert( pExpr->op==TK_ID );
if( ExprHasProperty(pExpr,EP_DblQuoted) ){
+ /* If a double-quoted identifier does not match any known column name,
+ ** then treat it as a string.
+ **
+ ** This hack was added in the early days of SQLite in a misguided attempt
+ ** to be compatible with MySQL 3.x, which used double-quotes for strings.
+ ** I now sorely regret putting in this hack. The effect of this hack is
+ ** that misspelled identifier names are silently converted into strings
+ ** rather than causing an error, to the frustration of countless
+ ** programmers. To all those frustrated programmers, my apologies.
+ **
+ ** Someday, I hope to get rid of this hack. Unfortunately there is
+ ** a huge amount of legacy SQL that uses it. So for now, we just
+ ** issue a warning.
+ */
+ sqlite3_log(SQLITE_WARNING,
+ "double-quoted string literal: \"%w\"", zCol);
pExpr->op = TK_STRING;
pExpr->y.pTab = 0;
return WRC_Prune;