diff --git a/edb/edgeql/compiler/setgen.py b/edb/edgeql/compiler/setgen.py index da88907c5cc..edd61477f54 100644 --- a/edb/edgeql/compiler/setgen.py +++ b/edb/edgeql/compiler/setgen.py @@ -1959,9 +1959,6 @@ def should_materialize( if not isinstance(ir, irast.Set): return reasons - if irtyputils.is_free_object(ir.typeref): - reasons.append(irast.MaterializeVolatile()) - typ = get_set_type(ir, ctx=ctx) assert ir.path_scope_id is not None diff --git a/tests/test_edgeql_group.py b/tests/test_edgeql_group.py index 8e8a88168a8..90bbd714536 100644 --- a/tests/test_edgeql_group.py +++ b/tests/test_edgeql_group.py @@ -1499,14 +1499,7 @@ async def test_edgeql_group_destruct_immediately_02(self): ["element", "element", "element", "element"], ) - @test.xerror(""" - Issue #5796 - - Materialized set not finalized. - """) async def test_edgeql_group_issue_5796(self): - # Fails on assert mat_set.materialized . - # Depends on double select and deck in shape await self.assert_query_result( r''' with @@ -1528,7 +1521,6 @@ async def test_edgeql_group_issue_5796(self): ]), ) - @test.xerror("Issue #6059") async def test_edgeql_group_issue_6059(self): await self.assert_query_result( r''' @@ -1547,7 +1539,6 @@ async def test_edgeql_group_issue_6059(self): [{"keyCard": {}}] * 4, ) - @test.xerror("Issue #6060") async def test_edgeql_group_issue_6060(self): await self.assert_query_result( r''' @@ -1609,13 +1600,10 @@ async def test_edgeql_group_issue_6019_a(self): ) by .key ''') - @test.xerror(""" - Issue #6019 - - Grouping on key should probably be rejected. - (And if not, it should not ISE!) - """) async def test_edgeql_group_issue_6019_b(self): + # This didn't work because group created free objects which were then + # materialized as volatile. `group (group X by .x) by .key` has a + # different cause. await self.assert_query_result( ''' with diff --git a/tests/test_edgeql_insert.py b/tests/test_edgeql_insert.py index 498ddbbfb21..24083714e4c 100644 --- a/tests/test_edgeql_insert.py +++ b/tests/test_edgeql_insert.py @@ -6814,6 +6814,32 @@ async def test_edgeql_insert_volatile_42(self): [1], ) + async def test_edgeql_insert_with_freeobject_01(self): + await self.con.execute(''' + WITH free := { name := "asdf" }, + SELECT (INSERT Person { name := free.name }); + ''') + + await self.assert_query_result( + 'SELECT Person.name = "asdf"', + [True], + ) + + async def test_edgeql_insert_with_freeobject_02(self): + await self.con.execute(''' + WITH free := { name := random() }, + SELECT (INSERT Person { name := free.name, tag := free.name }); + ''') + + await self.assert_query_result( + 'WITH P := (Person {ok := .name = .tag}) SELECT all(P.ok)', + [True], + ) + await self.assert_query_result( + 'SELECT count(distinct(Person.name))', + [1], + ) + async def test_edgeql_insert_multi_exclusive_01(self): await self.con.execute(''' INSERT Person { name := "asdf", multi_prop := "a" };