CREATE EXTENSION plperlu; CREATE FUNCTION tied_setof_text() RETURNS SETOF text LANGUAGE plperlu AS $$ use Tie::Array; my @a; tie @a, 'Tie::StdArray'; @a = ('p', 'q', 'r'); return \@a; $$; SELECT * FROM tied_setof_text();