Skip to content

Commit e4a4212

Browse files
committed
randgen: skip virtual columns in generate_test_objects
If we don't, then `validateTableIndexes` will fail. Found when running `local` logic tests against the test tenant. Epic: None Release note: None
1 parent e0235d0 commit e4a4212

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pkg/sql/catalog/randgen/templates.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ outer:
138138
}
139139

140140
for _, origColDef := range origDesc.Columns {
141-
// We don't take over hidden/inaccessible columns.
142-
if origColDef.Hidden || origColDef.Inaccessible {
141+
// We don't take over hidden/inaccessible/virtual columns.
142+
if origColDef.Hidden || origColDef.Inaccessible || origColDef.Virtual {
143143
continue
144144
}
145145
colID := t.desc.NextColumnID

pkg/sql/logictest/testdata/logic_test/gen_test_objects

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ SELECT crdb_internal.generate_test_objects('{"seed":1234,"counts":[10],"table_te
169169
----
170170
{"databases": 0, "schemas": 0, "tables": 10}
171171

172+
# Regression test for not ignoring virtual columns.
173+
query T
174+
SELECT crdb_internal.generate_test_objects('{"seed":1234,"counts":[1],"table_templates":["system.statement_statistics"]}'::JSONB)->'generated_counts'
175+
----
176+
{"databases": 0, "schemas": 0, "tables": 1}
177+
172178
query T
173179
SELECT table_name FROM [SHOW TABLES]
174180
ORDER BY table_name
@@ -182,6 +188,7 @@ priVileges
182188
replication_critical_localities
183189
role_id_seq
184190
statement_bundle_chunks
191+
sta😣tement_statistics
185192
ten ant_set tings
186193

187194
# Again, the column names are randomized.

0 commit comments

Comments
 (0)