Thank You Guy, As you probably already read I solved it writing the whole html page into a single table line. I don't know if your solution would do it: It happens inside a pl/pgsql function. The file names varies like t1.html, t2.html, etc. where the t# is defined inside a FOR row IN select_query LOOP. The written table have its rows deleted in all interactions after it is COPYed TO. Is it possible to redirect output from inside a pl/pgsql function? Regards, Clodoaldo --- Guy Fraser <guy@incentre.net> escreveu: > Ahh, I see. > > Like this from the command line : > > psql --no-align --tuples-only --field-separator , -c "select > data,comment from test_table order by test_id ;" database >/tmp/file > > From psql prompt : > > \a\t\f, > select data,comment from test_table order by test_id \g /tmp/file > \a\t\f| > > Either way you should get a file {/tmp/file} contaning : > > 27,some kind of entry > 32,another kind of entry > 16,yet another entry > ... > ______________________________________________________________________ Yahoo! Messenger - Fale com seus amigos online. Instale agora! http://br.download.yahoo.com/messenger/ ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster