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

WIP: omitempty bug in InsertRecords #23

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

Conversation

ScreamingHawk
Copy link

When you have a table with a field tagged omitempty, calling InsertRecords will fail if some records have empty values and some do not. The error is pgkit: ERROR: VALUES lists must all be the same length (SQLSTATE 42601).

This is because the reflection (correctly) ignores the fields tagged omitempty, which results in different fields being supplied for the insert statement.

https://github.com/goware/pgkit/blob/master/builder.go#L51
https://github.com/goware/pgkit/blob/master/mapper.go#L41

NOTE: This PR is only to share the failing test case.

@VojtechVitek
Copy link
Member

Hmm, I'm not sure why CI jobs didn't trigger.

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