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 issue with schema changes when trigger depends on a rewrite #6706

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

msullivan
Copy link
Member

Dependencies on rewrites, policies, and triggers don't get explicitly
tracked as references, but the things they depend on transitively
through those do.

The dummy expression for rewrites is not the correct type, so if a
trigger and a rewrite are being reprocessed in _propagate_if_expr refs
at the same time, and the trigger uses the rewrite, and is processed
first, then it will error.
Fix this by having the rewrite dummy expression have the right type.

I've experimented with having rewrites and triggers explicitly tracked
as dependencies, but it complicates some code and I don't think it
actually fixes any real problems.

Dependencies on rewrites, policies, and triggers don't get explicitly
tracked as references, but the things they depend on transitively
through those do.

The dummy expression for rewrites is not the correct type, so if a
trigger and a rewrite are being reprocessed in _propagate_if_expr refs
at the same time, and the trigger uses the rewrite, and is processed
first, then it will error.
Fix this by having the rewrite dummy expression have the right type.

I've experimented with having rewrites and triggers explicitly tracked
as dependencies, but it complicates some code and I don't think it
actually fixes any real problems.
@@ -223,7 +233,9 @@ def get_dummy_expr_field_value(
value: Any,
) -> Optional[s_expr.Expression]:
if field.name == 'expr':
return s_expr.Expression(text='false')
pt = self.scls.get_ptr_target(schema)
text = f'<{pt.get_displayname(schema)}>{{}}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is just a cast of an empty set to the correct type?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah

@msullivan msullivan merged commit 392fe5e into master Jan 24, 2024
24 checks passed
@msullivan msullivan deleted the rewrite-issue branch January 24, 2024 05:33
aljazerzen pushed a commit that referenced this pull request Jan 25, 2024
Dependencies on rewrites, policies, and triggers don't get explicitly
tracked as references, but the things they depend on transitively
through those do.

The dummy expression for rewrites is not the correct type, so if a
trigger and a rewrite are being reprocessed in _propagate_if_expr refs
at the same time, and the trigger uses the rewrite, and is processed
first, then it will error.
Fix this by having the rewrite dummy expression have the right type.

I've experimented with having rewrites and triggers explicitly tracked
as dependencies, but it complicates some code and I don't think it
actually fixes any real problems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants