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

QueryBuilder: Add upsert #48595

Open
kesselb opened this issue Oct 7, 2024 · 0 comments
Open

QueryBuilder: Add upsert #48595

kesselb opened this issue Oct 7, 2024 · 0 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: database Database related DB

Comments

@kesselb
Copy link
Contributor

kesselb commented Oct 7, 2024

Is your feature request related to a problem? Please describe.

PostgreSQL and MariaDB/MySQL will log a unique constraint violation in their logs (e.g. duplicate key value violates unique constraint for PostgreSQL). Even if the exception is handled in our application code, the log will still clutter the logs.

We introduced insertIgnoreConflict to suppress the error, but it still requires two SQL statements. Nicer would be to add support for upserts to our query builder.

Doctrine DBAL does not support upserts.
Laravel supports upsert:https://github.com/laravel/framework/pull/34698/files

Upsert is not standardized, and thus the actual query looks different for each vendor:

Possible use cases for upsert.

@kesselb kesselb added 0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: database Database related DB labels Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: database Database related DB
Projects
None yet
Development

No branches or pull requests

1 participant