symfony 不喜欢 PostgreSQL 的原则:build-schema
当我使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
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.该解决方案发布在这里:http://trac.symfony-project.org/ticket/9152
The solution is published here: http://trac.symfony-project.org/ticket/9152