Uploaded image for project: 'Doctrine 1'
  1. Doctrine 1
  2. DC-919

Import/Pgsql.php: listTableColumns - SQL failure with PostgreSQL


    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.3
    • Fix Version/s: None
    • Component/s: Import/Export
    • Labels:
    • Environment:
      Postgres Import Schema



      this issue was reported at the symfony project which uses Doctrine 1.2.3:
      "php symfony doctrine:build-schema failure with PostgreSQL for 1.4.7 and 1.4.8 version"

      The SQL Statement 'listTableColumns' fails with an SQL-Error "missing from-clause"
      I can reproduce the error directly in psql or pgadmin. The SQL Statement seems related to DC-697

      Even when i turn on the add_missing_from option on the postgres-server it fails with "missing relation".

      Now it seems to me, you already fixed this bug in the current 1.2 branch, because the current SQL-Statement is different and it works for me in psql/pgadmin.

      Could you please close this ticket, if you already fixed this issue, or confirm if it's still an issue?
      Attached you find my proposed patch at the symfony project . the current statement in the branch looks too different from my version, so i am not sure to use this patch directly. Tell me if I should work out a proper patch.

      SQLSTATE[42P01]: Undefined table: 7 ERROR:  missing FROM-clause entry for table "t"                                               
       	  LINE 6: ...                                                  t.typtype ...                                                       
       	                                                               ^. Failing Query: "SELECT                                           
       	                                                       ordinal_position as attnum,                                                 
       	                                                       column_name as field,                                                       
       	                                                       udt_name as type,                                                           
       	                                                       data_type as complete_type,                                                 
       	                                                       t.typtype AS typtype,                                                       
       	                                                       is_nullable as isnotnull,                                                   
       	                                                       column_default as default,                                                   
       	                                                         SELECT 't'                                                                 
       	                                                           FROM pg_index, pg_attribute a, pg_class c, pg_type t                     
       	                                                           WHERE c.relname = table_name AND a.attname = column_name                 
       	                                                           AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid           
       	                                                           AND c.oid = pg_index.indrelid AND a.attnum = ANY (pg_index.indkey)       
       	                                                           AND pg_index.indisprimary = 't'                                         
       	                                                           AND format_type(a.atttypid, a.atttypmod) NOT LIKE 'information_schema%' 
       	                                                       ) as pri,                                                                   
       	                                                       character_maximum_length as length                                           
       	                                                     FROM information_schema.COLUMNS                                               
       	                                                     WHERE table_name = 'matable'                                   
       	                                                     ORDER BY ordinal_position"  


        christian_vogel Christian Vogel created issue -


          • Assignee:
            jwage Jonathan H. Wage
            christian_vogel Christian Vogel
          • Votes:
            4 Vote for this issue
            4 Start watching this issue


            • Created: