postgresql - 如何将 colpivot 功能放在视图中?
问题描述
我正在使用函数 colpivot.sql ( https://github.com/hnsl/colpivot ) 将行动态转换为列。我需要将此查询的结果放在 PostgreSQL 的视图中。
CREATE OR REPLACE VIEW fun_test AS
SELECT colpivot('_test_pivoted',
'select * from _test',
array['year', 'month'],
array['country', 'state'],
'#.income', null);
SELECT * FROM _test_pivoted;
当我执行查询时,它给了我以下错误:
ERROR: column "colpivot" has pseudotype void
SQL state: 42P16
我怎样才能让它工作?
解决方案
推荐阅读
- java - 爪哇。对深拷贝对象使用反射
- javascript - 持久门无法读取未定义的属性“订阅”
- deep-learning - 在 PyTorch 的“MaxPool2D”中,是否根据“ceil_mode”添加填充?
- vb.net - 函数调用本身无法返回唯一值
- node.js - 我需要将用户输入作为获取请求的一部分提交给 unsplash 服务器
- typescript - 有什么方法可以优化在 VSTS 中生成代码覆盖率报告的时间吗?
- github - 为什么“发布”事件也会生成“推送”事件?
- r - readxl 如何误读 excel xlsx 文件以及如何修复它?
- php - 如何在 Slim 4 中注入多个 PDO 实例
- reactjs - 在 ReactJs 中动态删除部分表单时的焦点字段