Skip to content

Commit 883910d

Browse files
committed
Fix key identification to address data population
Signed-off-by: Shawn Bulen <bulens@pacbell.net>
1 parent 6e810cb commit 883910d

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Sources/Db/APIs/PostgreSQL.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ public function insert(string $method, string $table, array $columns, array $dat
411411

412412
// PostgreSQL doesn't support replace: we implement a MySQL-compatible behavior instead
413413
if ($method == 'replace' || $method == 'ignore') {
414-
$key_str = '';
414+
$key_str = implode(',', $keys);
415415
$col_str = '';
416416

417417
$count = 0;
@@ -420,8 +420,6 @@ public function insert(string $method, string $table, array $columns, array $dat
420420
foreach ($columns as $columnName => $type) {
421421
// Check pk field.
422422
if (\in_array($columnName, $keys)) {
423-
$key_str .= ($count_pk > 0 ? ',' : '');
424-
$key_str .= $columnName;
425423
$count_pk++;
426424
}
427425
// Normal field.

Sources/Db/Schema/Table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ public function populate(bool $replace = false): int
547547
table: '{db_prefix}' . $this->name,
548548
columns: Db::$db->getTypeIndicators('{db_prefix}' . $this->name, reset($this->initial_data)),
549549
data: array_map(fn($row) => array_values($row), $this->initial_data),
550-
keys: isset($auto_col) ? [$auto_col] : [],
550+
keys: isset($auto_col) ? [$auto_col] : array_column($this->indexes['primary']->columns, 'name'),
551551
returnmode: $returnmode,
552552
);
553553

0 commit comments

Comments
 (0)