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

Postgres Upsert command does not support specifying index predicate for partial unique indices #394

Closed
smaximov opened this issue Feb 19, 2021 · 0 comments · Fixed by #395

Comments

@smaximov
Copy link
Contributor

Currently there's no way to generate the following "upsert" query (which uses partial unique index) using the Upsert command:

# Assuming this unique partial index exists:
# CREATE UNIQUE INDEX idx ON my_table (some_column) WHERE another_column = 'foo'

INSERT INTO my_table(...) VALUES(...)
ON CONFLICT (some_column) WHERE another_column = 'foo'
DO ...

Although we can set "some_column" as conflict_target, it won't work because the user can't specify the partial index predicate (which is necessary to infer the partial index).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants