@@ -1275,24 +1275,19 @@ func (og *operationGenerator) createTable(ctx context.Context, tx pgx.Tx) (*opSt
12751275 )
12761276 stmt .Table = * tableName
12771277 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 {
12891281 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 ) {
12911283 return true
12921284 }
12931285 }
12941286 return false
1295- }()
1287+ }
1288+ hasVectorType := hasColumnTypeWithPrefix ("VECTOR" )
1289+ hasCitextType := hasColumnTypeWithPrefix ("CITEXT" )
1290+ hasLtreeType := hasColumnTypeWithPrefix ("LTREE" )
12961291
12971292 // Randomly create as schema locked table.
12981293 versionBefore253 , err := isClusterVersionLessThan (ctx , tx , clusterversion .V25_3 .Version ())
@@ -1326,6 +1321,8 @@ func (og *operationGenerator) createTable(ctx context.Context, tx pgx.Tx) (*opSt
13261321 {code : pgcode .FeatureNotSupported , condition : hasVectorType },
13271322 {code : pgcode .Syntax , condition : hasCitextType },
13281323 {code : pgcode .FeatureNotSupported , condition : hasCitextType },
1324+ {code : pgcode .Syntax , condition : hasLtreeType },
1325+ {code : pgcode .FeatureNotSupported , condition : hasLtreeType },
13291326 })
13301327 opStmt .sql = tree .Serialize (stmt )
13311328 return opStmt , nil
@@ -4111,9 +4108,19 @@ func (og *operationGenerator) randType(
41114108 return nil , nil , err
41124109 }
41134110
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+
41144120 typ := randgen .RandSortingType (og .params .rng )
41154121 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 ) {
41174124 typ = randgen .RandSortingType (og .params .rng )
41184125 }
41194126
@@ -4301,6 +4308,11 @@ FROM
43014308 return nil , err
43024309 }
43034310
4311+ ltreeNotSupported , err := isClusterVersionLessThan (ctx , tx , clusterversion .V25_4 .Version ())
4312+ if err != nil {
4313+ return nil , err
4314+ }
4315+
43044316 // Generate random parameters / values for builtin types.
43054317 for i , typeVal := range randgen .SeedTypes {
43064318 // If we have types where invalid values can exist then skip over these,
@@ -4317,6 +4329,9 @@ FROM
43174329 if citextNotSupported && typeVal .Oid () == oidext .T_citext {
43184330 continue
43194331 }
4332+ if ltreeNotSupported && typeVal .Oid () == oidext .T_ltree {
4333+ continue
4334+ }
43204335
43214336 possibleReturnReferences = append (possibleReturnReferences , typeVal .SQLStandardName ())
43224337 possibleParamReferences = append (possibleParamReferences , fmt .Sprintf ("val_%d %s" , i + len (enums ), typeVal .SQLStandardName ()))
0 commit comments