当我用我的 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。
最佳答案
t.typtype
子句在那里没有任何意义。查询在这方面被打破了。您应该将此报告给作者。
关于postgresql - symfony 不喜欢带有 :build-schema Doctrine 的 PostgreSQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4478986/