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

support DECLARE in BEGIN...END BLOCK in TRIGGER #2446

Merged
merged 14 commits into from
Apr 12, 2024
Merged

support DECLARE in BEGIN...END BLOCK in TRIGGER #2446

merged 14 commits into from
Apr 12, 2024

Conversation

jycor
Copy link
Contributor

@jycor jycor commented Apr 11, 2024

This PR allows us to use DECLARE statements in TRIGGERS.
The analyzer rule applyTriggers was altered to initialize ProcedureReference for TriggerBeginEndBlock.
The important part was ensuring that all relevant nodes (TriggerBeingEndBlock, BeginEndBlock, ProcedureParam) all had the same ProcedureReference and to search in all the nodes.

Additionally, nil guards are added to all receiver methods for ProcedureReference to prevent panics.

It seems like events might have this issue, but there's a banaid fix for it. Not sure if I want to touch that code.

fixes: dolthub/dolt#7720

Copy link
Contributor

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

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

LGTM! only thing i'd change is reverting/skipping TestSingleScript

Copy link
Contributor

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

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

lgtm again! more tests and tighter organization definitely improvements

@jycor jycor merged commit bce4903 into main Apr 12, 2024
7 checks passed
@jycor jycor deleted the james/trigger branch April 12, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash on BEFORE INSERT trigger using DECLARE variable
2 participants