2010-12-18 70 views
1

我在運行doctrine:build-schema和PostgreSQL數據庫時發生了奇怪的事情。它應該只是工作,但我得到這個:symfony不喜歡PostgreSQL的教條:build-schema

[email protected]:~/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"   

任何想法爲什麼會發生這種情況?

蹩腳的部分是,即使我可以修復SQL查詢,真正的問題是,symfony/Doctrine沒有按預期工作。學說聲稱支持PostgreSQL,看起來其他人在使用PostgreSQL時沒有問題,所以這很奇怪。

我在symfony 1.4.8和Doctrine 1.2上。

+2

這看起來像一個錯誤,那麼爲什麼不報告呢? 另外,我想你是從一個schema.yml文件構建。嘗試刪除它的一半,然後重建,如果仍然出現錯誤,請嘗試刪除其餘一半的類定義,等等,直到您知道哪些特定定義會導致錯誤。另外,你是否嘗試切換到另一個DBMS來看到它只發生在PostgreSQL上? – greg0ire 2010-12-18 22:23:46

+1

這通常是一個很好的建議,但我不是從schema.yml文件構建的。我從數據庫構建schema.yml文件。關於DBMS,是的。多年來,我一直在使用symfony和MySQL,沒有任何問題。 – 2010-12-21 13:34:51

回答

2

t.typtype子句在這裏沒有任何意義。查詢在這方面被打破。你應該向作者報告這一點。