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

NamedExec/slice does not work with Postgres INSERT ... ON CONFLICT #657

Closed
cbndr opened this issue Oct 6, 2020 · 1 comment · Fixed by #718
Closed

NamedExec/slice does not work with Postgres INSERT ... ON CONFLICT #657

cbndr opened this issue Oct 6, 2020 · 1 comment · Fixed by #718

Comments

@cbndr
Copy link

cbndr commented Oct 6, 2020

First of all, thanks for this fantastic lib, Jason! It has saved me countless hours in implementing database interfaces!

I recently came across a new(?) feature which allows a NamedExec to receive a slice of structs. This works beautifully with a simple INSERT statement, generating a VALUES (...), (...), (....) ... list.

However, it does not work with the Postgres INSERT INTO table VALUES (...) ON CONFLICT DO UPDATE SET column1 = :gofield1, column2 = :gofield2, ... type of statement, as the arguments for the latter part are not "multiplied out" for all slice elements, but only appended once to the args array.

@hyperhtml
Copy link

To add, this also has issues in mysql

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 a pull request may close this issue.

2 participants