Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-65

No way to store binary data in PostgreSQL with Doctrine


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      PostgreSQL 8.4


      The type system introduced by Doctrine makes impossible to store binary data in PostgreSQL databases that use Unicode. The `text` type is mapped to `TEXT`, but any trial to place some binary data there ends up with a database error, like this:

      SQLSTATE[22021]: Character not in repertoire: 7 ERROR: invalid byte sequence for encoding "UTF8": 0x9c

      This is a critical limitation, because Doctrine cannot be used now in projects that for any reasons have to use PostgreSQL, and their databases must store binary data. Even if it cannot be fixed right now, it should be clearly pointed out in the documentation in "Known vendor issues".

      A possible solution for this problem is creating an equivalent of 'text' field, called 'binary' or something like that. It must be a simple type that is mapped to the simplest, but large type available in the database engine without any form of data structure validation. For PostgreSQL, this could be 'blob', but other database engines can use different types.


        Tomasz Jędrzejewski created issue -
        Tomasz Jędrzejewski made changes -
        Field Original Value New Value
        Priority Critical [ 2 ] Major [ 3 ]
        Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 12128 ] jira-feedback2 [ 17675 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17675 ] jira-feedback3 [ 20030 ]


          • Assignee:
            Benjamin Eberlei
            Tomasz Jędrzejewski
          • Votes:
            0 Vote for this issue
            2 Start watching this issue


            • Created: