postgresql 中的 Crosstab() 函数导致错误。 (已安装 tablefunc 模块)
Crosstab() function in postgresql causes error. (tablefunc module installed)
我正在使用 postgresql 9.3.9。
我CREATE EXTENSION tablefunc;
成功了。
现在,当我尝试做一个简单的交叉表查询时,例如:
select * from crosstab('select col_1, col_2 from table order by 1,2')
我收到这个错误:
Error in query: ERROR: function crosstab(unknown) does not exist
HINT: No function matches the given name and argument types. You might need to add explicit type casts
我做错了什么?我尝试向文本添加显式转换,但这没有帮助。
要检查是否真的安装了扩展程序,请执行以下操作:
select count(*) from information_schema.routines where routine_name like 'crosstab%'
如果returns0,你应该检查你是否在正确的数据库中安装了扩展,以及你是否提交了CREATE EXTENSION
语句。
我正在使用 postgresql 9.3.9。
我CREATE EXTENSION tablefunc;
成功了。
现在,当我尝试做一个简单的交叉表查询时,例如:
select * from crosstab('select col_1, col_2 from table order by 1,2')
我收到这个错误:
Error in query: ERROR: function crosstab(unknown) does not exist
HINT: No function matches the given name and argument types. You might need to add explicit type casts
我做错了什么?我尝试向文本添加显式转换,但这没有帮助。
要检查是否真的安装了扩展程序,请执行以下操作:
select count(*) from information_schema.routines where routine_name like 'crosstab%'
如果returns0,你应该检查你是否在正确的数据库中安装了扩展,以及你是否提交了CREATE EXTENSION
语句。