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

Add error handling for nil builders when calling Exec for Upsert #4056

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pthm
Copy link

@pthm pthm commented May 16, 2024

A small contribution to add a check to the Exec call as part of the Upsert functionality.

Occasionally I would see cases where developers mistakenly construct a slice of builders usually by instantiating a slice with a set length and then not setting a builder for each index resulting in nils being passed to the CreateBulk method.

This would then result in a panic from the Exec call when it tries to call len on the b.conflict property.

This change checks if b is nil and returns an error to hopefully help people more easily debug this type of issue.

@jvgreenaway
Copy link

this would be so handy

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.

None yet

2 participants