Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix referencing ext::auth::ClientTokenIdentity from a link default #8394

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions edb/pgsql/schemamech.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,8 @@ def get_ref_storage_info(
source_typeref = ref.typeref
if not irtyputils.is_object(source_typeref):
continue
if irtyputils.is_free_object(source_typeref):
continue
schema, t = irtyputils.ir_typeref_to_type(schema, ref.typeref)
assert isinstance(t, s_sources.Source)
ptr = t.getptr(schema, s_name.UnqualName('id'))
Expand Down
22 changes: 22 additions & 0 deletions tests/test_edgeql_ddl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2046,6 +2046,28 @@ async def test_edgeql_ddl_default_15(self):
insert T;
""")

async def test_edgeql_ddl_default_16(self):
await self.con.execute(r"""
create type T;
insert T;
alter type T {
create required property y: str {
set default := (with x := { y := "lol" }, select x.y)
}
};
insert T;
""")

await self.assert_query_result(
r"""
select T { y }
""",
[
{'y': "lol"},
{'y': "lol"},
],
)

async def test_edgeql_ddl_default_circular(self):
await self.con.execute(r"""
CREATE TYPE TestDefaultCircular {
Expand Down
9 changes: 9 additions & 0 deletions tests/test_http_ext_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,15 @@ class TestHttpExtAuth(tb.ExtAuthTestCase):

CONFIGURE CURRENT DATABASE
INSERT ext::auth::MagicLinkProviderConfig {{}};

# Pure testing code:
CREATE TYPE TestUser;
ALTER TYPE TestUser {{
CREATE REQUIRED LINK identity: ext::auth::Identity {{
SET default := (GLOBAL ext::auth::ClientTokenIdentity)
}};
}};

""",
]

Expand Down