mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Attribut named "default" #6984
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Jcs1994 on GitHub (May 23, 2022).
Bug Report
Summary
Doctrine doesn't handle an attribut named
default, it crashes when inserting in databaseCurrent behavior
An attribut named
defaultmake doctrine crash on INSERTHow to reproduce
Add an attribut to an entity named
defaultGenerate migration (it's working)
$this->addSql('ALTER TABLE X.myTable ADD "default" BOOLEAN DEFAULT \'false\' NOT NULL');Execute migration
Persist and flush the entity
Expected behavior
Doctrine should generate SQL with double quotes on
defaultword'INSERT INTO X.myTable(enabled, "default", deleted_at, created_at, updated_at, business_unit_id, ebics_connection_provider_id) VALUES (?, ?, ?, ?, ?, ?, ?)' with params [1, 0, null, "2022-05-23 13:07:48", "2022-05-23 13:07:48", "3", "5"]
@derrabus commented on GitHub (May 23, 2022):
What database engine and version is this?
@Jcs1994 commented on GitHub (May 23, 2022):
Postgres 12.9
@greg0ire commented on GitHub (May 23, 2022):
Aren't you supposed to quote that keyword? https://www.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#quoting-reserved-words
@Jcs1994 commented on GitHub (May 23, 2022):
oh yes my bad