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: Fixed NULL not being formatted for slices/maps. #1930

Closed
wants to merge 1 commit into from

Conversation

elliotcourant
Copy link
Collaborator

When a query parameter was a nil slice or a nil map, the value NULL
would not be appended to the query. Instead 'null' would be appended
to the query which is not correct.

Resolves #1908

When a query parameter was a nil slice or a nil map, the value `NULL`
would not be appended to the query. Instead `'null'` would be appended
to the query which is not correct.

Resolves go-pg#1908
// value.
if v.IsNil() {
return AppendNull(b, flags)
}
}
appender := Appender(v.Type())
Copy link
Member

Choose a reason for hiding this comment

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

The idea is that you should be able to call Appender once for a type and then use it to append different values of the given type (nil or non-nil). So the function returned by appender should handle nil values, not appendValue itself.

I guess it is not worth fixing this properly so let's keep this code, but at least we should have an end-to-end test that inserts and selects slice/map from a real table...

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.

incorrect query marshalling the nil []string to null
2 participants