Skip to content

Commit 2a0787b

Browse files
committed
Double check for when cols are nulls
1 parent 3017537 commit 2a0787b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/bwc/test_upgrade.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def assert_data_persistence(self,
306306
cursor.execute(f'insert into versioned."{table}" (id, col_int) values (?, ?)', [str(uuid4()), 1])
307307

308308
# to trigger `alter` stmt bug(https://github.com/crate/crate/pull/17178) that falsely updated the table's
309-
# version created setting that resulted in oids replacing column names in resultsets
309+
# version created setting that resulted in oids instead of column names in resultsets
310310
cursor.execute('ALTER TABLE doc.parted SET ("refresh_interval" = 900)')
311311

312312
# older versions had a bug that caused this to fail
@@ -315,14 +315,18 @@ def assert_data_persistence(self,
315315
obj = {key: True}
316316
args = (str(uuid4()), version, obj)
317317
cursor.execute(
318-
'INSERT INTO doc.parted (id, version, cols) values (?, ?, ?)',
318+
'INSERT INTO doc.parted (id, version, cols) VALUES (?, ?, ?)',
319319
args
320320
)
321+
cursor.execute('REFRESH TABLE doc.parted')
321322
accumulated_dynamic_column_names.append(key)
322-
cursor.execute('SELECT cols from doc.parted')
323+
cursor.execute('SELECT cols FROM doc.parted')
323324
result = cursor.fetchall()
324325
for row in result:
325-
if row[0] is not None:
326+
if row[0] is None:
327+
cursor.execute('SELECT * FROM doc.parted where col is null')
328+
assert False, cursor.fetchall()
329+
else:
326330
for name in row[0].keys():
327331
self.assertIn(name, accumulated_dynamic_column_names)
328332
self._process_on_stop()

0 commit comments

Comments
 (0)