From d59707603839615d2c3ba484907cf3e47a68416b Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Thu, 10 Sep 2015 12:19:51 +0200 Subject: [PATCH] Subtle bug that occurred selecting after a join Outer joins add the placeholder '---' that is used as some sort of NULL value. However select operations on such relations would always fail, because relations are supposed to only contain values of class rstring, and the placeholder was added as a regular string. As a consequence, automatic casting would always fail, and the select would always raise an exception. Added a new test case with this specific case in mind. --- CHANGELOG | 1 + relational/relation.py | 2 +- test/select_join.query | 1 + test/select_join.result | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 test/select_join.query create mode 100644 test/select_join.result diff --git a/CHANGELOG b/CHANGELOG index a6d40ce..3f9db1b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ - Introduced sessions; GUI loads the same relations of the previous time - GUI is modified, to be fit smaller screens - Fix bug in tokenizer +- Fixed bug where select on relations with '---' values would always fail 2.0 - Fix bug in relational-cli that made it crash when an exception was raised diff --git a/relational/relation.py b/relational/relation.py index 62595b9..6191713 100644 --- a/relational/relation.py +++ b/relational/relation.py @@ -323,7 +323,7 @@ class Relation (object): added = True # If it didn't partecipate, adds it if not added: - item = chain(i, repeat('---', len(noid))) + item = chain(i, repeat(rstring('---'), len(noid))) newt.content.add(tuple(item)) return newt diff --git a/test/select_join.query b/test/select_join.query new file mode 100644 index 0000000..18692f6 --- /dev/null +++ b/test/select_join.query @@ -0,0 +1 @@ +σ id==3(people ⧓ skills) diff --git a/test/select_join.result b/test/select_join.result new file mode 100644 index 0000000..51a573d --- /dev/null +++ b/test/select_join.result @@ -0,0 +1,2 @@ +id,skill,name,chief,age +3,C++,dean,1,33