From 17080aa38149dcede39ed52766a0c2bd624f8a62 Mon Sep 17 00:00:00 2001 From: LtWorf Date: Wed, 13 May 2009 14:06:42 +0000 Subject: [PATCH] fixed problem with select and renames when using fields git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@171 014f5005-505e-4b48-8d0a-63407b615a7c --- relational/optimizations.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/relational/optimizations.py b/relational/optimizations.py index 9a877cf..0b348eb 100644 --- a/relational/optimizations.py +++ b/relational/optimizations.py @@ -213,7 +213,6 @@ def swap_rename_select(n): them with ρ j(σ k(R)). Renaming the attributes used in the selection, so the operation is still valid.''' #TODO document into the wiki - #FIXME selection of date.day won't work. changes=0 if n.name=='σ' and n.child.name=='ρ': @@ -229,8 +228,12 @@ def swap_rename_select(n): #Renaming stuff for i in range(len(_tokens)): - if _tokens[i] in _vars: - _tokens[i]=_vars[_tokens[i]] + splitted=_tokens[i].split('.',1) + if splitted[0] in _vars: + if len(splitted)==1: + _tokens[i]=_vars[_tokens[i].split('.')[0]] + else: + _tokens[i]=_vars[_tokens[i].split('.')[0]]+'.'+splitted[1] #Swapping operators n.name='ρ'