Uploaded image for project: 'Doctrine DBAL'
  1. Doctrine DBAL
  2. DBAL-40

Transparent table&column names escaping


    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3, 2.4, 2.4.1
    • Fix Version/s: None
    • Component/s: Platforms
    • Labels:


      Hello, I would like to re-open the discussion about automatic transparent escaping of all table/column names sent from DBAL to database. It was already discussed in http://www.doctrine-project.org/jira/browse/DDC-88 without any satisfactory result.

      Why do I have to quote any reserved word used in table or column name? Why Doctrine doesn't do this automatically for all table and column
      names used in generated SQL queries?

      Before you start to explain how complicated it is and what problems you will be faced with, try to look at excellent DIBI database layer - how it acts in this way - it's behaviour is very cool. Unfortunally at the moment the full documentation is in czech only, but here is a brief automatic google-translation to english - http://dibiphp.com/en/quick-start.

      My suggestion to Doctrine 2 ORM/DBAL solution is:

      1. Developer should never care about any escaping or avoiding any reserved words - it is not his business, the DBAL shoult solve it transparently and safely.

      2. So there should be no need and even no possibility to add any quotation chars in @column or @table annotations as well as in DQL queries. ORM layer has nothing to do with escaping, it is all a business of the DBAL layer. Current possibility for manual escaping the names in mentioned annotations is totally wrong and should be discontinued.

      3. DBAL should escape ALL table and column names transparently and automatically. There should be ne option to enable or disable the escaping, there is no reason for disabling it.

      4. The escaping should be performed just in the final translation of DBAL queries to native SQL query, not earlier. This is the right place to do that.

      So what do you think about that?

        Issue Links


          jantichy Jan Tichý created issue -
          beberlei Benjamin Eberlei made changes -
          Field Original Value New Value
          Link This issue relates to DBAL-96 [ DBAL-96 ]
          beberlei Benjamin Eberlei made changes -
          Workflow jira [ 11724 ] jira-feedback2 [ 17561 ]
          beberlei Benjamin Eberlei made changes -
          Workflow jira-feedback2 [ 17561 ] jira-feedback3 [ 19915 ]
          thinkscape Arthur Bodera made changes -
          Affects Version/s 2.4 [ 10320 ]
          Affects Version/s 2.3 [ 10184 ]
          Affects Version/s 2.4.1 [ 10527 ]
          thinkscape Arthur Bodera made changes -
          Component/s Platforms [ 10056 ]


            • Assignee:
              beberlei Benjamin Eberlei
              jantichy Jan Tichý
            • Votes:
              13 Vote for this issue
              14 Start watching this issue


              • Created: