Hello, code for genereting xml: CREATE OR REPLACE FUNCTION ext.xml(varchar) RETURNS text AS $$ use DBI; use XML::Generator::DBI; use XML::Handler::YAWriter; my $rv = spi_exec_query("SELECT current_setting('client_encoding'), " . "current_database()", 1); my $encoding = lc($rv->{rows}[0]->{current_setting[5~}); my $cdb = $rv->{rows}[0]->{current_database}; my $dbh = DBI->connect ("DBI:Pg:dbname=$cdb", "", "", { RaiseError => 1, PrintError => 0}); my $ya = XML::Handler::YAWriter->new (Encoding=>$encoding, Pretty => {PrettyWhiteNewline => 1, PrettyWhiteIndent => 1,}); my $gen = XML::Generator::DBI->new (Handler => $ya, dbh => $dbh, ByColumnName => 1, ShowColumns => 1,); $gen->execute ($_[0]); $dbh->disconnect (); return join('',@{$ya->{Strings}}); $$ LANGUAGE plperlu; SELECT ext.xml('SELECT * FROM ext.jmena LIMIT 10'); Sending mail, or uploud file via HTTP isn't problem. PL/Perlu works very fine. Regards Pavel Stehule ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster