Hi all, I should have explained it better:
Why don't I just insert each line in the table and let "copy to" do its thing inserting a new line char (lf) at the end of each line? Because I need the file lines to be in a certain order. Copy to will copy the lines in its own order. Until now I'm inserting html pages in a single line table without a lf and copying then to files. Here is the result: http://planeta.terra.com.br/informatica/kakaostats/ http://planeta.terra.com.br/informatica/kakaostats/t13802.html Right click the page and click view source and there it is, a single giant line. The problem with mixing html and pl/pgsql is that it becomes a big mess. It is very hard to evolve the code and understand it. So I choose to not output html anymore but cvs text and build the page with php. Advantages: much simpler pl/pgsql code and upload size 80% smaller. Lines finishing with a lf are much easier to parse in php (fgetcsv). This and the need to have then ordered is why i need to insert lfs in the single line table from which to copy to file. I have solved it with a simple python script but it is one more step and is not fail safe. Where there would be a lf I insert the string "newLine". Then in the python script I change it to an actual lf char. But in the remote possibility that there is or there will be this string in the database (600+ thousand distinct user names) then the output file will be wrong. Also it is one more piece of software to be mantained. Regards, Clodoaldo Pinto --- Clodoaldo Pinto Neto <[EMAIL PROTECTED]> escreveu: > Hi all, > > I'm trying to copy a table with a text field column containing a new > line char to a file: > > ksDesenv=# create table page(line text) without oids; > CREATE TABLE > ksDesenv=# insert into page (line) > values('1stline'||chr(10)||'2ndline'); > INSERT 0 1 > ksDesenv=# select * from page; > line > ----------------- > 1stline > 2ndline > (1 registro) > > ksDesenv=# copy page to '/var/www/html/kakaostats/page.txt'; > COPY > > But this is what the page.txt file looks like: > > 1stline\n2ndline > > What can I do to make the copy to command insert an actual new line > char? > > Regards, > Clodoaldo Pinto Neto > > > > > > _______________________________________________________ > Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! > Acesse: http://br.acesso.yahoo.com/ > > ---------------------------(end of > broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to > [EMAIL PROTECTED] > _______________________________________________________ Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: http://br.acesso.yahoo.com/ ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html