pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: Sergei M. Suntsov <serge@uic.nsu.ru>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] newline in text field
Date: Sun, 8 Nov 1998 14:12:28 +0200
Message-ID: <l0311070ab26b39b4e509@[147.233.159.109]> (raw)
In-Reply-To: <Pine.LNX.3.95.981108174813.978A-100000@ns.uic.nsu.ru>

At 13:50 +0200 on 8/11/98, Sergei M. Suntsov wrote:


>   Hello
> I would like to insert into text field strings separated by newline
> character ('\n') using psql. How should I quote newline characters if it
> is possible ?
>    Thanx in advance.
> Sergei

It depends on the context. If you want to put it in an insert string, you
don't have to quote it. You do something like:

INSERT INTO my_table ( text_field )
VALUES (
'...And yet by heaven I swear my love as rare
As any she belied with false compare!' );

If you are doing it within COPY, where newline has significance as a
delimiter, you should put a backslash before it:

COPY my_table FROM stdin;
...And yet by heaven I swear my love as rare\
As any she belied with false compare!
\.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma





view thread (2+ messages)

Message-ID: <l0311070ab26b39b4e509@[147.233.159.109]>
Permalink:  ../l0311070ab26b39b4e509@%5B147.233.159.109%5D/
Also on:    postgresql.org/message-id/l0311070ab26b39b4e509@[147.233.159.109]

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: herouth@oumail.openu.ac.il, serge@uic.nsu.ru
  Subject: Re: [SQL] newline in text field
  In-Reply-To: <l0311070ab26b39b4e509@[147.233.159.109]>
  References: <Pine.LNX.3.95.981108174813.978A-100000@ns.uic.nsu.ru> <l0311070ab26b39b4e509@[147.233.159.109]>

* 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