diff --git a/edb/edgeql/compiler/options.py b/edb/edgeql/compiler/options.py index a13e0ecf2d4c..d76c2171f7ec 100644 --- a/edb/edgeql/compiler/options.py +++ b/edb/edgeql/compiler/options.py @@ -82,11 +82,6 @@ class GlobalCompilerOptions: #: the query plan. is_explain: bool = False - #: Should type inheritance be expanded using CTEs. - #: When not explaining CTEs can be used to provide access to a type and its - #: descendents. - use_inheritance_ctes: bool = True - #: The name that can be used in a "DML is disallowed in ..." #: error. When this is not None, any DML should cause an error. in_ddl_context_name: Optional[str] = None diff --git a/edb/edgeql/compiler/typegen.py b/edb/edgeql/compiler/typegen.py index 8751ae6a137d..e172a7647c1f 100644 --- a/edb/edgeql/compiler/typegen.py +++ b/edb/edgeql/compiler/typegen.py @@ -401,13 +401,7 @@ def type_to_typeref( include_children = ( expr_type is s_types.ExprType.Update or expr_type is s_types.ExprType.Delete - or ( - ( - env.options.is_explain or - env.options.use_inheritance_ctes - ) - and isinstance(t, s_objtypes.ObjectType) - ) + or isinstance(t, s_objtypes.ObjectType) ) include_ancestors = ( expr_type is s_types.ExprType.Insert diff --git a/edb/pgsql/compiler/__init__.py b/edb/pgsql/compiler/__init__.py index 6f9895fec817..30ef1f09cfdc 100644 --- a/edb/pgsql/compiler/__init__.py +++ b/edb/pgsql/compiler/__init__.py @@ -67,7 +67,6 @@ def compile_ir_to_sql_tree( named_param_prefix: Optional[tuple[str, ...]] = None, expected_cardinality_one: bool = False, is_explain: bool = False, - use_inheritance_ctes: bool = False, external_rvars: Optional[ Mapping[Tuple[irast.PathId, pgce.PathAspect], pgast.PathRangeVar] ] = None, @@ -129,7 +128,6 @@ def compile_ir_to_sql_tree( ignore_object_shapes=ignore_shapes, explicit_top_cast=explicit_top_cast, is_explain=is_explain, - use_inheritance_ctes=use_inheritance_ctes, singleton_mode=singleton_mode, scope_tree_nodes=scope_tree_nodes, external_rvars=external_rvars, diff --git a/edb/pgsql/compiler/context.py b/edb/pgsql/compiler/context.py index 129ea620c852..ec50561b8c6b 100644 --- a/edb/pgsql/compiler/context.py +++ b/edb/pgsql/compiler/context.py @@ -549,7 +549,6 @@ def __init__( ignore_object_shapes: bool, singleton_mode: bool, is_explain: bool, - use_inheritance_ctes: bool, explicit_top_cast: Optional[irast.TypeRef], query_params: List[irast.Param], type_rewrites: Dict[RewriteKey, irast.Set], @@ -569,7 +568,6 @@ def __init__( self.ignore_object_shapes = ignore_object_shapes self.singleton_mode = singleton_mode self.is_explain = is_explain - self.use_inheritance_ctes = use_inheritance_ctes self.explicit_top_cast = explicit_top_cast self.query_params = query_params self.type_rewrites = type_rewrites diff --git a/edb/pgsql/compiler/relctx.py b/edb/pgsql/compiler/relctx.py index dfeeff6eb572..fc742646287b 100644 --- a/edb/pgsql/compiler/relctx.py +++ b/edb/pgsql/compiler/relctx.py @@ -1655,7 +1655,7 @@ def range_for_material_objtype( # using a CTE. This allows postgres to actually give us back the # alias names that we use for relations, which we use to track which # parts of the query are being referred to. - not ctx.env.use_inheritance_ctes + ctx.env.is_explain # Don't use CTEs if there is no inheritance. (ie. There is only a # single material type) @@ -2206,7 +2206,9 @@ def _range_for_component_ptrref( ) if ( - not ctx.env.use_inheritance_ctes + # If explaining, expand inheritance directly as a union of pointers. + # See range for typerefs for more information. + ctx.env.is_explain # Don't use CTEs if there is no inheritance. (ie. There is only a # single ptrref) diff --git a/edb/server/compiler/compiler.py b/edb/server/compiler/compiler.py index 39f23ef2774b..d717441ccf5a 100644 --- a/edb/server/compiler/compiler.py +++ b/edb/server/compiler/compiler.py @@ -1701,11 +1701,6 @@ def _get_compile_options( allow_user_specified_id=_get_config_val( ctx, 'allow_user_specified_id') or ctx.schema_reflection_mode, is_explain=is_explain, - use_inheritance_ctes=( - not is_explain - and not ctx.bootstrap_mode - and not ctx.schema_reflection_mode - ), testmode=_get_config_val(ctx, '__internal_testmode'), schema_reflection_mode=( ctx.schema_reflection_mode @@ -1891,7 +1886,6 @@ def _compile_ql_query( output_format=_convert_format(ctx.output_format), backend_runtime_params=ctx.backend_runtime_params, is_explain=options.is_explain, - use_inheritance_ctes=options.use_inheritance_ctes, detach_params=(use_persistent_cache and cache_mode is config.QueryCacheMode.PgFunc), versioned_stdlib=True,