symfony doesn't like PostgreSQL with doctrine:

2019-07-26 22:09发布

问题:

I'm having a weird thing happen when I run doctrine:build-schema with my PostgreSQL database. It should just work, of course, but instead I'm getting this:

jason@ve:~/salon$ ./symfony doctrine:build-schema
>> doctrine  generating yaml schema from database


  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 = 'salon'                                                     
ORDER BY ordinal_position"        

Any idea why this is happening?

The crappy part is that even if I can fix the SQL query, the real problem is that symfony/Doctrine is not working as expected. Doctrine claims to support PostgreSQL it appears that other people are using PostgreSQL with build-schema without problems, so this is weird.

I'm on symfony 1.4.8 and Doctrine 1.2.

回答1:

The t.typtype clause doesn't make any sense there. The query is broken in that regard. You should report this to the authors.



回答2:

The solution is published here: http://trac.symfony-project.org/ticket/9152