From fe59dca08173b55d533752013ed76c838aba9794 Mon Sep 17 00:00:00 2001
From: Tobias Schmidt <tobias.schmidt@unibas.ch>
Date: Tue, 22 May 2012 17:22:27 +0200
Subject: [PATCH] TableClass: extending table works properly with non-matching
 column names

---
 modules/base/pymod/table.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/base/pymod/table.py b/modules/base/pymod/table.py
index 0f902e3e1..3a12c898f 100644
--- a/modules/base/pymod/table.py
+++ b/modules/base/pymod/table.py
@@ -1758,12 +1758,13 @@ class Table(object):
     
     # check that column types are the same in current and new table
     for name in self.col_names:
-      curr_type = self.col_types[self.GetColIndex(name)]
-      new_type = tab.col_types[tab.GetColIndex(name)]
-      if curr_type!=new_type:
-        raise TypeError('cannot extend table, column %s in new '%name +\
-                        'table different type (%s) than in '%new_type +\
-                        'current table (%s)'%curr_type)
+      if name in tab.col_names:
+        curr_type = self.col_types[self.GetColIndex(name)]
+        new_type = tab.col_types[tab.GetColIndex(name)]
+        if curr_type!=new_type:
+          raise TypeError('cannot extend table, column %s in new '%name +\
+                          'table different type (%s) than in '%new_type +\
+                          'current table (%s)'%curr_type)
     
     num_rows = len(tab.rows)
     for i in range(0,num_rows):
-- 
GitLab