pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matt Van Mater <nutter_@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: how to preserve \n in select statement
Date: Fri, 19 Dec 2003 10:06:28 -0500
Message-ID: <BAY9-F53yNIKFVlAbTy00003a01@hotmail.com> (raw)

I have a table that has a few text value types, and I enter a bunch of text 
with '\n' representing a newline.  When I select the records from that 
table, postgresql 7.3 represents those \n as newlines and actually outputs 
the a newline rather than as a \n as entered.  I want to be able to get my 
\n text out of the select statement in the exact same manner it was 
inserted.

I found a workaround where I can use the copy to command to copy a table to 
a text file, and the command preserves the \n characters.  The problem with 
that is the copy to command overwrites the output file every time it is 
written to.  That stinks because then I can't run multiple queries and 
direct the output to a file all at once.  (I would prefer to set the output 
file as  \o '/path/to/oufile.txt' and have all queries dump their results 
there)

Is there a way to make the select statement not interpret newline escape 
characters?

Matt Van Mater

_________________________________________________________________
Have fun customizing MSN Messenger — learn how here!  
http://www.msnmessenger-download.com/tracking/reach_customize




view thread (11+ messages)  latest in thread

Message-ID: <BAY9-F53yNIKFVlAbTy00003a01@hotmail.com>
Permalink:  ../BAY9-F53yNIKFVlAbTy00003a01@hotmail.com/
Also on:    postgresql.org/message-id/BAY9-F53yNIKFVlAbTy00003a01@hotmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: nutter_@hotmail.com
  Subject: Re: how to preserve \n in select statement
  In-Reply-To: <BAY9-F53yNIKFVlAbTy00003a01@hotmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox