Skip to content

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