Fix non-rewritten tuple literals (#6521)

This commit is contained in:
Aljaž Mur Eržen 2023-11-27 19:25:41 +01:00 committed by GitHub
parent 750f936551
commit 5838aaa6a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View file

@ -964,6 +964,7 @@ def process_insert_rewrites(
val = pathctx.get_path_var(
rew_stmt, e.path_id, aspect='value', env=ctx.env
)
val = output.output_as_value(val, env=ctx.env)
rew_stmt.target_list.append(pgast.ResTarget(
name=ptr_info.column_name, val=val))

View file

@ -1047,3 +1047,30 @@ class TestRewrites(tb.QueryTestCase):
'select Foo { will_be_true }',
[{'will_be_true': True}]
)
async def test_edgeql_rewrites_28(self):
await self.con.execute(
'''
create type Address {
create property coordinates: tuple<lat: float32, lng: float32>;
create property updated_at: str {
create rewrite insert using ('now')
};
};
insert Address {
coordinates := (
lat := <std::float32>40.07987,
lng := <std::float32>20.56509
)
};
'''
)
await self.assert_query_result(
'select Address { coordinates, updated_at }',
[
{
'coordinates': {'lat': 40.07987, 'lng': 20.56509},
'updated_at': 'now'
}
]
)