Postgres 9.2.1 在 OSX 10.9.2 上。
如果我运行以下的交叉表查询示例:
CREATE EXTENSION tablefunc;
CREATE TABLE ct(id SERIAL, rowid TEXT, attribute TEXT, value TEXT);
INSERT INTO ct(rowid, attribute, value) VALUES('test1','att1','val1');
SELECT *
FROM crosstab(
'select rowid, attribute, value
from ct
where attribute = ''att2'' or attribute = ''att3''
order by 1,2')
AS ct(row_name text, category_1 text, category_2 text, category_3 text);
我得到了:错误:扩展“tablefunc”已经存在
但如果我注释掉CREATE EXTENSION
,我会得到:错误:函数crosstab(未知类型)不存在
我怎样才能打破这个恶性循环?这是一个已知的问题吗?