【发布时间】:2015-09-12 16:49:48
【问题描述】:
create or replace function extr( tabname text ) returns text[] as
$$
declare cols text[];
begin
execute 'array(select column_name::text from information_schema.columns where table_name = '||quote_literal(tabname)||');' into cols;
return cols;
end;
$$
language 'plpgsql';
select extr('test');
提供一个表名并希望将其列名作为数组返回。上面的代码给出了“数组”或附近的语法错误。如何解决这个问题?
【问题讨论】:
标签: arrays postgresql plpgsql