Skip to content

Invalid quoting syntax for table names/schema in SQL Server #12041

@stlrnz

Description

@stlrnz

Bug Report

Q A
Version 3.3.2
Previous Version if the bug is a regression 3.3.1

Summary

After Updating doctrine/orm from 3.3.1 to 3.3.2, I get an error when selecting from an entity with quoted table name using SQL Server platform.
I think the issue was introduced with the following feature: #11811 (its the only change made in 3.3.2).

Current behavior

In the logs I can see that using v3.3.2 the schema and table name is quoted as one string: [schema.table]. This syntax is invalid in SQL Server.

Expected behavior

Until v3.3.1 the schema and table names were quoted individually: schema.[table]. This is valid SQL Server syntax.

How to reproduce

Create an entity using a quoted table name.

<?php

declare(strict_types=1);

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;

use function uuid_create;

#[ORM\Entity]
#[ORM\Table(name: '`file`', schema: 'myschema')]
class File
{
    #[ORM\Id]
    #[ORM\Column(type: 'guid', unique: true, nullable: false)]
    private string $id;

...

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions