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

prevent panic on triggers with declare statements #2442

Merged
merged 6 commits into from
Apr 10, 2024
Merged

prevent panic on triggers with declare statements #2442

merged 6 commits into from
Apr 10, 2024

Conversation

jycor
Copy link
Contributor

@jycor jycor commented Apr 9, 2024

We're reusing a code from stored procedures to handle begin end blocks, but we're missing a lot of set up that prevents certain variables from being nil. Consequently, we panic in a couple places.

This PR fixes some of those panics, but reveals other problems we have in resolving/executing triggers of this format.

Partially addresses: 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.

we chatted a bit about this, but if the goal is to not panic I think it might be safest/easiest to explicitly error in planbuilder when we're building a handler without an appropriate trigger context. Pushing it downstream risk undefined behavior or more panics

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, thanks for refactoring a bit. I think the errors here are nicely self-documenting.

return &ProcedureParam{
name: strings.ToLower(name),
typ: typ,
//pRef: NewProcedureReference(),
Copy link
Contributor

Choose a reason for hiding this comment

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

undo?

@jycor jycor merged commit 09d57d9 into main Apr 10, 2024
7 checks passed
@jycor jycor deleted the james/trigger branch April 10, 2024 07:42
nicktobey added a commit to dolthub/dolt that referenced this pull request Apr 10, 2024
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.

2 participants