1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-08 03:22:21 +03:00

Naming the join columns in the result set of a natural join does not result

in an "ambiguous column name" error.  Ticket #1217. (CVS 2494)

FossilOrigin-Name: 265fb6079c0a4b7a93f063939436db494ff1d56c
This commit is contained in:
drh
2005-06-06 16:59:24 +00:00
parent d70dc52d79
commit 355ef36114
4 changed files with 21 additions and 10 deletions

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.202 2005/05/24 20:19:59 drh Exp $
** $Id: expr.c,v 1.203 2005/06/06 16:59:24 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -825,6 +825,12 @@ static int lookupName(
pExpr->iColumn = j==pTab->iPKey ? -1 : j;
pExpr->affinity = pTab->aCol[j].affinity;
pExpr->pColl = pTab->aCol[j].pColl;
if( pItem->jointype & JT_NATURAL ){
/* If this match occurred in the left table of a natural join,
** then skip the right table to avoid a duplicate match */
pItem++;
i++;
}
break;
}
}