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

Preliminary pg upsert support #57

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

Conversation

zealot128
Copy link

@zealot128 zealot128 commented Oct 29, 2019

Implemented two ways,

1. "naive upsert" for pg < 9.5

insert into, on exception update all the things.

2. real upsert since 9.5

INSERT INTO .... ON CONFLICT id DO UPDATE SET ...

Also included a fix for exporting ActsAsTaggableOn - AATO adds it's own "tag_list" as a virtual attribute into the record.attributes, thus, is included in the "INSERT" statement.

The ac88b32 fixes that problem by comparing the attributes with column_names.


Would be nice if some user PG user would test it...

@jakeonfire
Copy link
Member

@zealot128 if you wouldn't mind rebasing master and getting a green build, we can finally merge this 😅

- Ignore virtual attributes (ActsAsTaggable...) on serialization
@zealot128
Copy link
Author

@zealot128 if you wouldn't mind rebasing master and getting a green build, we can finally merge this 😅

Squashed rebase is pushed. Let me know if there are any other issues.

@jakeonfire
Copy link
Member

looks like there is one legitimate exception:

expect { adapter.on_duplicate_key_update(double(), double()) }.to raise_error('on_duplicate: :override is not currently supported in the PostgreSQL adapter')

makes sense. can you fix the spec? otherwise i may be able to help at some point.

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.

None yet

2 participants