On Saturday 29 April 2006 10:23 am, Terry Lee Tucker <terry@xxxxxxxx> 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/