View Ticket
Not logged in
Ticket UUID: a7b7803e8d1e8699cd8a460a38133b98892d2e17
Title: crash when filtering twice by same predicate using aliases
Status: Fixed Type: Code_Defect
Severity: Critical Priority: Immediate
Subsystem: Code_Generator Resolution: Fixed
Last Modified: 2012-12-19 16:58:04
Version Found In: 3.7.15
User Comments:
nobody added on 2012-12-19 15:01:05:

Try the following:

 create table name (
   type integer,
   path text primary key);

select (name.type = 0) as container from Name name where name.type = 0 or container order by name.path


The select statement crashes during query preparation.


  char sqlite3ExprAffinity(Expr *pExpr){
    int op;
    pExpr = sqlite3ExprSkipCollate(pExpr);
    int op = pExpr->op;                               
    op = pExpr->op;
last line crashes because sqlite3ExprSkipCollate returns null.

nobody added on 2012-12-19 15:13:42:
pExpr is already NULL from caller 'exprAnalyzeOrTerm' -> affRight = sqlite3ExprAffinity(pOrTerm->pExpr->pRight);

drh added on 2012-12-19 15:16:52:

Bisecting shows that the bug was introduced by the refactoring of COLLATE at check-in [8542e6180d4321d45b], just a few days prior to the release of version 3.7.15, and needed to address bug [71e333e7d2e642afc96d2].

So, we fixed one bug but in the process introduced another....