agora inbox for postgres@postgres.berkeley.edu
help / color / mirror / Atom feedFrom: Robert.Patrick@cs.cmu.edu
To: postgres@postgres.Berkeley.EDU
Subject: Text string w/ a '\n' character???
Date: Tue, 20 Sep 1994 16:01:33 -0400 (EDT)
Message-ID: <MiTnyRq00hMd4Xy0sW@cs.cmu.edu> (raw)
In-Reply-To: <Pine.SUN.3.90a.940920082947.4636A-100000@ccfs1>
References: <Pine.SUN.3.90a.940920082947.4636A-100000@ccfs1>
We are developing an application which uses Postgres to store it's data.
The problem is that I need to be able to store text strings with
carriage return characters in them.
First, I tried just passing the raw '\n' character embedded in the
string to libpq. This causes me to receive a "scanner error"(something
about unterminated char or string) and nothing is stored in the text
field. Next, I tried inserting a '\' before the '\n' (since this
appears to work properly if done from the monitor). However, when
executed via libpq, Postgres just drops the carriage return entirely!
So I figured it was just a problem with the text data type and converted
everything to octal and tried to store it as a bytea data type.
Unfortunately, Postgres seems to treat the bytea data type exactly like
text (at least in this respect).
Is it possible to store a piece of text in Postgres without losing the
formatting (i.e., carriage returns)?
Robert
--
+------------------------------------------------------------------------+
| Robert Patrick _/_/_/_/ _/ _/ _/_/_/_/ |
| n-dim Group _/ _/ _/ _/ _/ _/ |
| Engineering Design Research Center _/ _/ _/ _/ _/ _/ |
| Department of Chemical Engineering _/ _/ _/ _/ _/ _/ |
| Carnegie Mellon University _/_/_/_/ _/_/_/_/_/ _/_/_/_/ |
| Pittsburgh, PA 15213 _/ _/ _/ _/ _/ |
| Phone: (412)268-5215 _/ _/ _/ _/ _/ |
| Fax: (412)268-5229 _/ _/ _/ _/ _/ |
| rp2y+@eiger.edrc.cmu.edu _/ _/ _/ _/ _/ |
| rp2y+@andrew.cmu.edu |
| World Wide Web: http://paneer.ndim.edrc.cmu.edu:8888/~rp2y/Home.html |
+------------------------------------------------------------------------+
==============================================================================
To add/remove yourself to/from the POSTGRES mailing list: send mail with
the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"
If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
a human will deal with it. DO NOT post to the "postgres" mailing list.
==============================================================================
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: postgres@postgres.berkeley.edu
Cc: Robert.Patrick@cs.cmu.edu
Subject: Re: Text string w/ a '\n' character???
In-Reply-To: <MiTnyRq00hMd4Xy0sW@cs.cmu.edu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox