'CreateOrExtendTable(table, columns)
Create a new table in the database.
If a table of this name already exists, extend it to have any
additional columns present in the given list as well as
all of its current columns.'

def CreateOrExtendTable(self, table, columns):

    assert isinstance(columns, list)
    try:
        self.CreateTable(table, columns)
    except TableAlreadyExists:
        txn = None
        try:
            columnlist_key = _columns_key(table)
            txn = self.env.txn_begin()
            oldcolumnlist = pickle.loads(getattr(self.db, 'get_bytes', self.db.get)(columnlist_key, txn=txn, flags=db.DB_RMW))
            oldcolumnhash = {}
            for c in oldcolumnlist:
                oldcolumnhash[c] = c
            newcolumnlist = copy.copy(oldcolumnlist)
            for c in columns:
                if (not (c in oldcolumnhash)):
                    newcolumnlist.append(c)
            if (newcolumnlist != oldcolumnlist):
                self.db.delete(columnlist_key, txn=txn)
                getattr(self.db, 'put_bytes', self.db.put)(columnlist_key, pickle.dumps(newcolumnlist, 1), txn=txn)
            txn.commit()
            txn = None
            self.__load_column_info(table)
        except db.DBError as dberror:
            if txn:
                txn.abort()
            if (sys.version_info < (2, 6)):
                raise TableDBError, dberror[1]
            else:
                raise TableDBError, dberror.args[1]
