-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Issue 12729 postgresql duplicate key value #13721
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
Changes from all commits
a48ea8c
c9b6487
d62da82
6335042
0d778fc
f889bea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,4 +35,17 @@ public function fixupStatement($statement) { | |
| $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement ); | ||
| return $statement; | ||
| } | ||
|
|
||
| /** | ||
| * @suppress SqlInjectionChecker | ||
| */ | ||
| public function insertIgnoreConflict(string $table,array $values) : int { | ||
| $builder = $this->conn->getQueryBuilder(); | ||
| $builder->insert($table); | ||
kesselb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| foreach($values as $key => $value) { | ||
| $builder->setValue($key, $builder->createNamedParameter($value)); | ||
| } | ||
| $queryString = $builder->getSQL() . ' ON CONFLICT DO NOTHING'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With which version of Postgres does this work? I only can find it in the docs since Postgres 9.5.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aye. Caused this regression: #15613
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😢 |
||
| return $this->conn->executeUpdate($queryString, $builder->getParameters(), $builder->getParameterTypes()); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.