On Saturday 29 April 2006 10:23 am, Terry Lee Tucker <terry(at)esc1(dot)com> thus communicated: --> You cannot do that with plpgsql. You can use Perl in "trusted" mode and pass --> the query results to the Perl function which can write the output to a ffile. --> Correcting typeo: s/trusted/untrusted/