@@ -24,6 +24,7 @@ import (
24
24
"github.com/cockroachdb/cockroach/pkg/sql/catalog/catpb"
25
25
"github.com/cockroachdb/cockroach/pkg/sql/catalog/colinfo"
26
26
"github.com/cockroachdb/cockroach/pkg/sql/lexbase"
27
+ "github.com/cockroachdb/cockroach/pkg/sql/oidext"
27
28
"github.com/cockroachdb/cockroach/pkg/sql/parser"
28
29
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode"
29
30
"github.com/cockroachdb/cockroach/pkg/sql/randgen"
@@ -1283,6 +1284,15 @@ func (og *operationGenerator) createTable(ctx context.Context, tx pgx.Tx) (*opSt
1283
1284
}
1284
1285
return false
1285
1286
}()
1287
+ hasCitextType := func () bool {
1288
+ // Check if any of the columns have CITEXT types involved.
1289
+ for _ , def := range stmt .Defs {
1290
+ if col , ok := def .(* tree.ColumnTableDef ); ok && col .Type .SQLString () == "CITEXT" {
1291
+ return true
1292
+ }
1293
+ }
1294
+ return false
1295
+ }()
1286
1296
1287
1297
// Randomly create as schema locked table.
1288
1298
versionBefore253 , err := isClusterVersionLessThan (ctx , tx , clusterversion .V25_3 .Version ())
@@ -1314,6 +1324,8 @@ func (og *operationGenerator) createTable(ctx context.Context, tx pgx.Tx) (*opSt
1314
1324
opStmt .potentialExecErrors .addAll (codesWithConditions {
1315
1325
{code : pgcode .Syntax , condition : hasVectorType },
1316
1326
{code : pgcode .FeatureNotSupported , condition : hasVectorType },
1327
+ {code : pgcode .Syntax , condition : hasCitextType },
1328
+ {code : pgcode .FeatureNotSupported , condition : hasCitextType },
1317
1329
})
1318
1330
opStmt .sql = tree .Serialize (stmt )
1319
1331
return opStmt , nil
@@ -4090,8 +4102,18 @@ func (og *operationGenerator) randType(
4090
4102
return nil , nil , err
4091
4103
}
4092
4104
4105
+ // Block CITEXT usage until v25.3 is finalized.
4106
+ citextNotSupported , err := isClusterVersionLessThan (
4107
+ ctx ,
4108
+ tx ,
4109
+ clusterversion .V25_3 .Version ())
4110
+ if err != nil {
4111
+ return nil , nil , err
4112
+ }
4113
+
4093
4114
typ := randgen .RandSortingType (og .params .rng )
4094
- for pgVectorNotSupported && typ .Family () == types .PGVectorFamily {
4115
+ for (pgVectorNotSupported && typ .Family () == types .PGVectorFamily ) ||
4116
+ (citextNotSupported && typ .Oid () == oidext .T_citext ) {
4095
4117
typ = randgen .RandSortingType (og .params .rng )
4096
4118
}
4097
4119
@@ -4274,6 +4296,11 @@ FROM
4274
4296
possibleParamReferences = append (possibleParamReferences , fmt .Sprintf (`enum_%d %s` , i , enum ["name" ]))
4275
4297
}
4276
4298
4299
+ citextNotSupported , err := isClusterVersionLessThan (ctx , tx , clusterversion .V25_3 .Version ())
4300
+ if err != nil {
4301
+ return nil , err
4302
+ }
4303
+
4277
4304
// Generate random parameters / values for builtin types.
4278
4305
for i , typeVal := range randgen .SeedTypes {
4279
4306
// If we have types where invalid values can exist then skip over these,
@@ -4287,6 +4314,10 @@ FROM
4287
4314
continue
4288
4315
}
4289
4316
4317
+ if citextNotSupported && typeVal .Oid () == oidext .T_citext {
4318
+ continue
4319
+ }
4320
+
4290
4321
possibleReturnReferences = append (possibleReturnReferences , typeVal .SQLStandardName ())
4291
4322
possibleParamReferences = append (possibleParamReferences , fmt .Sprintf ("val_%d %s" , i + len (enums ), typeVal .SQLStandardName ()))
4292
4323
optionalDefaultValue := randgen .RandDatum (og .params .rng , typeVal , true )
0 commit comments