symfony 不喜欢 PostgreSQL 的原则:build-schema

发布于 2024-10-08 05:59:37 字数 2361 浏览 0 评论 0原文

当我使用 PostgreSQL 数据库运行 doctrine:build-schema 时,发生了一件奇怪的事情。当然,它应该可以工作,但我得到的是:

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"        

知道为什么会发生这种情况吗?

糟糕的是,即使我可以修复 SQL 查询,真正的问题是 symfony/Doctrine 无法按预期工作。 Doctrine 声称支持 PostgreSQL,但似乎其他人正在使用带有 build-schema 的 PostgreSQL 没有任何问题,所以这很奇怪。

我使用的是 symfony 1.4.8 和 Doctrine 1.2。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

把回忆走一遍 2024-10-15 05:59:37

t.typtype 子句在那里没有任何意义。在这方面,查询已被破坏。您应该向作者报告这一点。

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

夏末 2024-10-15 05:59:37

该解决方案发布在这里:http://trac.symfony-project.org/ticket/9152

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文