我正在使用 redshift 并想创建一个逗号分隔的列列表。我正在尝试使用以下方法从信息架构中获取列名listagg
:
SELECT
listagg(column_name,',') within group (order by ordinal_position)
FROM information_schema.columns
WHERE table_schema = 'my_schema'
AND table_name = 'my table';
我收到以下错误:
[Amazon](500310) Invalid operation: Function (listagg(text,text)) must be applied on at least one user created tables;