closes #78681: stcheck don't crash on column aliases used in outer join

authorSylvain Th?nault <sylvain.thenault@logilab.fr>
changeset8828046c2d3b
branchstable
phasepublic
hiddenno
parent revision#446b635cb163 default is stable
child revision#a031d85966f1 stable is 0.31, #4a0bbee051e0 backport stable, #31130f18a5ef oldstable is 0.30
files modified by this revision
ChangeLog
stcheck.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1318335284 -7200
# Tue Oct 11 14:14:44 2011 +0200
# Branch stable
# Node ID 8828046c2d3b47371f6659430d4492b2bcaf1f68
# Parent 446b635cb1638a1820ead0c1d19bdcb3482eece4
closes #78681: stcheck don't crash on column aliases used in outer join

diff --git a/ChangeLog b/ChangeLog
@@ -1,10 +1,16 @@
1  ChangeLog for RQL
2  =================
3 
4 +--
5 +    * #78681: don't crash on column aliases used in outer join
6 +
7 +
8  2011-09-07  --  0.30.1
9 -    * #74727: allow entity types to end with a capitalized letter provided they contain a lower-cased letter
10 +
11 +    * #74727: allow entity types to end with a capitalized letter
12 +      provided they contain a lower-cased letter
13 
14 
15 
16  2011-08-05  --  0.30.0
17      * #72295: add some missing operators:
diff --git a/stcheck.py b/stcheck.py
@@ -544,16 +544,18 @@
18                              if v1 != v2:
19                                  vargraph.setdefault(v1, []).append(v2)
20                                  vargraph.setdefault(v2, []).append(v1)
21                  if term.optional in ('left', 'both'):
22                      for var in lhsvariables:
23 -                        optcomps = var.stinfo['attrvar'].stinfo.setdefault('optcomparisons', set())
24 -                        optcomps.add(term)
25 +                        if var.stinfo['attrvar'] is not None:
26 +                            optcomps = var.stinfo['attrvar'].stinfo.setdefault('optcomparisons', set())
27 +                            optcomps.add(term)
28                  if term.optional in ('right', 'both'):
29                      for var in rhsvariables:
30 -                        optcomps = var.stinfo['attrvar'].stinfo.setdefault('optcomparisons', set())
31 -                        optcomps.add(term)
32 +                        if var.stinfo['attrvar'] is not None:
33 +                            optcomps = var.stinfo['attrvar'].stinfo.setdefault('optcomparisons', set())
34 +                            optcomps.add(term)
35 
36      def rewrite_shared_optional(self, exists, var, identity_rel_scope=None):
37          """if variable is shared across multiple scopes, need some tree
38          rewriting
39          """