Skip to content

Commit 20e020d

Browse files
committed
default expr/gen col/constraints
1 parent 54392cd commit 20e020d

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Diff for: tests/bwc/test_rolling_upgrade.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,21 @@ def _test_rolling_upgrade(self, path, nodes):
113113
c.execute("deny dql on table doc.t1 to arthur")
114114
c.execute("CREATE VIEW doc.v1 AS SELECT type, title, value FROM doc.t1")
115115
insert_data(conn, 'doc', 't1', 1000)
116-
117116
c.execute("INSERT INTO doc.t1 (type, value, title, author) VALUES (1, 1, 'matchMe title', {name='no match name'})")
118117
c.execute("INSERT INTO doc.t1 (type, value, title, author) VALUES (2, 2, 'no match title', {name='matchMe name'})")
119-
120118
c.execute("INSERT INTO doc.t1 (title, author, o) VALUES ('prefix_check', {\"dyn_empty_array\" = []}, {\"dyn_ignored_subcol\" = 'hello'})")
121119

120+
c.execute('''
121+
create table doc.t2 (
122+
a int primary key,
123+
b int not null,
124+
c int default random() * 100,
125+
d generated always as (a + b + c),
126+
constraint d CHECK (d > a + b)
127+
) clustered into 1 shards with (number_of_replicas = 0)
128+
''')
129+
expected_active_shards += 1
130+
122131
c.execute('''
123132
CREATE FUNCTION foo(INT)
124133
RETURNS INT
@@ -266,6 +275,13 @@ def _test_rolling_upgrade(self, path, nodes):
266275
# Add the shards of the new partition primaries
267276
expected_active_shards += shards
268277

278+
c.execute("select count(*) from doc.t2")
279+
count = c.fetchall()[0][0]
280+
c.execute(f"insert into doc.t2(a, b) values ({idx}, {idx})")
281+
c.execute("refresh table t2")
282+
c.execute("select count(*) from doc.t2")
283+
self.assertEqual(c.fetchall()[0][0], count + 1)
284+
269285
# skip 5.5 -> 5.6 and later versions, they fail due to https://github.com/crate/crate/issues/17734
270286
if int(path.to_version.split('.')[1]) < 5:
271287
with connect(replica_cluster.node().http_url, error_trace=True) as replica_conn:

0 commit comments

Comments
 (0)