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

Support Upsert in postgres #20

Open
ZaneZ opened this issue Dec 14, 2019 · 0 comments
Open

Support Upsert in postgres #20

ZaneZ opened this issue Dec 14, 2019 · 0 comments

Comments

@ZaneZ
Copy link

ZaneZ commented Dec 14, 2019

The statment of UPSERT in postgres:

INSERT INTO ... ON CONFLICT ON CONSTRAINT DO UPDATE ...

Currently in
https://github.com/Selvatico/go-mocket/blob/master/stmt.go#L16, command only takes in first word.

And for INSERT Case, there is only RowsAffected = 1 option if do not identify the error.
https://github.com/Selvatico/go-mocket/blob/master/stmt.go#L86

Proposed solution, one of the two will work for postgres.

  1. detect whether there is a update followed by insert

  2. instead of checking command using first word, do a backward search of the key words lists.

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

No branches or pull requests

1 participant