Skip to content

Commit af9acb0

Browse files
committed
Fix key identification to address data population
Signed-off-by: Shawn Bulen <[email protected]>
1 parent 883910d commit af9acb0

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Sources/Db/APIs/PostgreSQL.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -413,17 +413,11 @@ public function insert(string $method, string $table, array $columns, array $dat
413413
if ($method == 'replace' || $method == 'ignore') {
414414
$key_str = implode(',', $keys);
415415
$col_str = '';
416-
417416
$count = 0;
418-
$count_pk = 0;
419417

418+
// Make a list of the non-pk fields.
420419
foreach ($columns as $columnName => $type) {
421-
// Check pk field.
422-
if (\in_array($columnName, $keys)) {
423-
$count_pk++;
424-
}
425-
// Normal field.
426-
elseif ($method == 'replace') {
420+
if (!\in_array($columnName, $keys) && ($method == 'replace')) {
427421
$col_str .= ($count > 0 ? ',' : '');
428422
$col_str .= $columnName . ' = EXCLUDED.' . $columnName;
429423
$count++;

0 commit comments

Comments
 (0)