@@ -1275,24 +1275,19 @@ func (og *operationGenerator) createTable(ctx context.Context, tx pgx.Tx) (*opSt
1275
1275
)
1276
1276
stmt .Table = * tableName
1277
1277
stmt .IfNotExists = og .randIntn (2 ) == 0
1278
- hasVectorType := func () bool {
1279
- // Check if any of the indexes have PGVector types involved.
1280
- for _ , def := range stmt .Defs {
1281
- if col , ok := def .(* tree.ColumnTableDef ); ok && strings .HasPrefix (col .Type .SQLString (), "VECTOR" ) {
1282
- return true
1283
- }
1284
- }
1285
- return false
1286
- }()
1287
- hasCitextType := func () bool {
1288
- // Check if any of the columns have CITEXT types involved.
1278
+
1279
+ // Helper function to check if any column has a type with the given prefix.
1280
+ hasColumnTypeWithPrefix := func (typePrefix string ) bool {
1289
1281
for _ , def := range stmt .Defs {
1290
- if col , ok := def .(* tree.ColumnTableDef ); ok && col .Type .SQLString () == "CITEXT" {
1282
+ if col , ok := def .(* tree.ColumnTableDef ); ok && strings . HasPrefix ( col .Type .SQLString (), typePrefix ) {
1291
1283
return true
1292
1284
}
1293
1285
}
1294
1286
return false
1295
- }()
1287
+ }
1288
+ hasVectorType := hasColumnTypeWithPrefix ("VECTOR" )
1289
+ hasCitextType := hasColumnTypeWithPrefix ("CITEXT" )
1290
+ hasLtreeType := hasColumnTypeWithPrefix ("LTREE" )
1296
1291
1297
1292
// Randomly create as schema locked table.
1298
1293
versionBefore253 , err := isClusterVersionLessThan (ctx , tx , clusterversion .V25_3 .Version ())
@@ -1326,6 +1321,8 @@ func (og *operationGenerator) createTable(ctx context.Context, tx pgx.Tx) (*opSt
1326
1321
{code : pgcode .FeatureNotSupported , condition : hasVectorType },
1327
1322
{code : pgcode .Syntax , condition : hasCitextType },
1328
1323
{code : pgcode .FeatureNotSupported , condition : hasCitextType },
1324
+ {code : pgcode .Syntax , condition : hasLtreeType },
1325
+ {code : pgcode .FeatureNotSupported , condition : hasLtreeType },
1329
1326
})
1330
1327
opStmt .sql = tree .Serialize (stmt )
1331
1328
return opStmt , nil
@@ -4111,9 +4108,19 @@ func (og *operationGenerator) randType(
4111
4108
return nil , nil , err
4112
4109
}
4113
4110
4111
+ // Block LTREE usage until v25.4 is finalized.
4112
+ ltreeNotSupported , err := isClusterVersionLessThan (
4113
+ ctx ,
4114
+ tx ,
4115
+ clusterversion .V25_4 .Version ())
4116
+ if err != nil {
4117
+ return nil , nil , err
4118
+ }
4119
+
4114
4120
typ := randgen .RandSortingType (og .params .rng )
4115
4121
for (pgVectorNotSupported && typ .Family () == types .PGVectorFamily ) ||
4116
- (citextNotSupported && typ .Oid () == oidext .T_citext ) {
4122
+ (citextNotSupported && typ .Oid () == oidext .T_citext ) ||
4123
+ (ltreeNotSupported && typ .Oid () == oidext .T_ltree ) {
4117
4124
typ = randgen .RandSortingType (og .params .rng )
4118
4125
}
4119
4126
@@ -4301,6 +4308,11 @@ FROM
4301
4308
return nil , err
4302
4309
}
4303
4310
4311
+ ltreeNotSupported , err := isClusterVersionLessThan (ctx , tx , clusterversion .V25_4 .Version ())
4312
+ if err != nil {
4313
+ return nil , err
4314
+ }
4315
+
4304
4316
// Generate random parameters / values for builtin types.
4305
4317
for i , typeVal := range randgen .SeedTypes {
4306
4318
// If we have types where invalid values can exist then skip over these,
@@ -4317,6 +4329,9 @@ FROM
4317
4329
if citextNotSupported && typeVal .Oid () == oidext .T_citext {
4318
4330
continue
4319
4331
}
4332
+ if ltreeNotSupported && typeVal .Oid () == oidext .T_ltree {
4333
+ continue
4334
+ }
4320
4335
4321
4336
possibleReturnReferences = append (possibleReturnReferences , typeVal .SQLStandardName ())
4322
4337
possibleParamReferences = append (possibleParamReferences , fmt .Sprintf ("val_%d %s" , i + len (enums ), typeVal .SQLStandardName ()))
0 commit comments