Re: Carraige Return issues - Mailing list pgsql-general

From Oliver Elphick
Subject Re: Carraige Return issues
Date
Msg-id 1025872021.31584.21.camel@linda
Whole thread Raw
In response to Re: Carraige Return issues  ("caroline kenny" <caroline_kenny@hotmail.com>)
List pgsql-general
On Fri, 2002-07-05 at 11:51, caroline kenny wrote:
> Thanks Oliver for your help....but I'm still having a small issue..
>
> What Im really trying to do is to insert/update a field in a particular
> table through perl script.
> When i run the perl script to insert the specifics into my table...i want
> that the file that to be entered into the specific field will be put in with
> its carriage returns....can u help further

So you're using UPDATE or INSERT called through your Perl script?

You need to replace newline with \n in the data being inserted or escape
the linefeeds with \.  You also need to escape any real backslash with
an extra backslash and you need to escape single-quotes, either with a
backslash or an extra single-quote.

    junk=# insert into tt values (3,'Line 1 of ''some\ntext with\
    junk'# linefeeds in it\n and \\s too.');
    INSERT 27417478 1
    junk=# select t from tt where id = 3;
                               t
    --------------------------------------------------------
     Line 1 of 'some
    text with
    linefeeds in it
     and \s too.
    (1 row)


If you're using Windows, you may also have to deal with their use of
CRLF as a line ending, as opposed to Unix's LF, but all that can be done
in Perl.

The Perl coding is left as an exercise for the reader - meaning I can't
work it out without looking things up!

Oliver




pgsql-general by date:

Previous
From: "caroline kenny"
Date:
Subject: Re: Carraige Return issues
Next
From: Angela Luyf
Date:
Subject: two primairy key in one table ?