Doctrine 1
  1. Doctrine 1
  2. DC-1014

Geographical behaviour generates wrong INSERT statement in PostgreSQL if latitude/logitude not specified

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Geographical
    • Labels:
      None
    • Environment:
      Symphony 1.4, PostgreSQL 8.4.8

      Description

      Added "Geographical" behaviour to an entity:

       
      ZipCode:
        actAs: [Geographical]
        columns:
          code: string
          [...]
      

      Using the standard Symfony-generated admin manager, when trying to insert a new record without specifying both latitude and longitude, Doctrine generates a wrong INSERT statement for PostgreSQL, including latitude and longitude as '' (empty string)

       
      Doctrine_Connection->exec('INSERT INTO zip_code (hidden, code,  country_id, latitude, longitude) VALUES (?, ?, ?, ?, ?)', array('false', '20133', '1', '', ''))
      

      This cause this error:
      SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type double precision: ""

      Workaround

      explicitly specifying float type for latitude and longitude...

       
        actAs: 
          Geographical:
            latitude: {type: float}
            longitude: {type: float}
      

      ...still generate the column correctly as double precision in the database, but will not cause any error on inserting records.

        Activity

        Lorenzo Nicora created issue -

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Lorenzo Nicora
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: