MySQL - schema can be created with reserved keyword but will produce an error when using it #5004

Open
opened 2026-01-22 14:56:20 +01:00 by admin · 0 comments
Owner

Originally created by @lbayerl on GitHub (Feb 3, 2016).

Originally assigned to: @Ocramius on GitHub.

Having a column definition like

/**
 * @ORM\Column(type="integer")
 */
private $interval;

using schema:update will produce an SQL statement using 'interval' - including apostrophes.
This will successfully create the schema.

But when using this column after schema creation with DQL (e.g. persist and flush a new object) it will produce an SQL statement using interval without apostrophes.
This will throw a SQL error as interval is a reserved keyword with MySQL.

This looks inconsistent to me.

Originally created by @lbayerl on GitHub (Feb 3, 2016). Originally assigned to: @Ocramius on GitHub. Having a column definition like ``` /** * @ORM\Column(type="integer") */ private $interval; ``` using _schema:update_ will produce an SQL statement using **'interval'** - including apostrophes. This will successfully create the schema. But when using this column after schema creation with DQL (e.g. persist and flush a new object) it will produce an SQL statement using **interval** without apostrophes. This will throw a SQL error as _interval_ is a reserved keyword with MySQL. This looks inconsistent to me.
admin added the Can't Fix label 2026-01-22 14:56:20 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5004