-
-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Description
I've got the bug using PostgreSQL.
Create a table
$b->createTable('page', [
'id' => $cb::uuidPrimaryKey(),
'title' => $cb::string()->notNull(),
'slug' => $cb::string()->notNull()->unique(),
'text' => $cb::text()->notNull(),
'created_at' => $cb::dateTime(),
'updated_at' => $cb::dateTime(),
]);Do upsert:
$this->connection->createCommand()->upsert('{{%page}}', [
'id' => $page->id,
'title' => $page->title,
'slug' => $page->getSlug(),
'text' => $page->text,
'created_at' => $page->createdAt,
'updated_at' => $page->updatedAt,
])->execute();Get the error:
QLSTATE[42P10]: Invalid column reference: 7 ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification
The SQL being executed was: INSERT INTO "page" ("id", "title", "slug", "text", "created_at", "updated_at") VALUES ('019b5c77-1c8b-72bd-a0c9-547987f9cf9c', 'Test', 'test', 'test', '2025-12-26 21:01:08', '2025-12-26 21:01:08') ON CONFLICT ("id", "slug") DO UPDATE SET "title"=EXCLUDED."title", "text"=EXCLUDED."text", "created_at"=EXCLUDED."created_at", "updated_at"=EXCLUDED."updated_at"
Package version
2.0.0
PHP version
8.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels