Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #416 > unrolled thread

Line breaks in PostgreSQL tables

Started byFranz Kruse <Franz.Kruse@t-online.de>
First post2012-10-31 00:12 +0100
Last post2012-11-01 08:53 +0000
Articles 6 — 4 participants

Back to article view | Back to comp.databases.postgresql


Contents

  Line breaks in PostgreSQL tables Franz Kruse <Franz.Kruse@t-online.de> - 2012-10-31 00:12 +0100
    Re: Line breaks in PostgreSQL tables Robert Klemme <shortcutter@googlemail.com> - 2012-10-31 19:51 +0100
      Re: Line breaks in PostgreSQL tables Franz Kruse <Franz.Kruse@t-online.de> - 2012-10-31 20:58 +0100
        Re: Line breaks in PostgreSQL tables mattheww@chiark.greenend.org.uk (Matthew Woodcraft) - 2012-10-31 20:39 +0000
        Re: Line breaks in PostgreSQL tables Robert Klemme <shortcutter@googlemail.com> - 2012-11-01 23:37 +0100
    Re: Line breaks in PostgreSQL tables Jasen Betts <jasen@xnet.co.nz> - 2012-11-01 08:53 +0000

#416 — Line breaks in PostgreSQL tables

FromFranz Kruse <Franz.Kruse@t-online.de>
Date2012-10-31 00:12 +0100
SubjectLine breaks in PostgreSQL tables
Message-ID<k6pmsh$qir$1@news.albasani.net>
We just started to use PostgreSQL. For new table entries (type TEXT) we 
find line breaks represented as \r\n (the Windows convention), wich is 
OK when shown in a browser, but causes strange multiple empty lines when 
these entries are sent via email.

Can this behaviour be configured, such that simple \n are used for line 
breaks?

Thanks for hints

Franz

[toc] | [next] | [standalone]


#417

FromRobert Klemme <shortcutter@googlemail.com>
Date2012-10-31 19:51 +0100
Message-ID<afdaa5Fh1quU1@mid.individual.net>
In reply to#416
On 10/31/2012 12:12 AM, Franz Kruse wrote:
> We just started to use PostgreSQL. For new table entries (type TEXT) we
> find line breaks represented as \r\n (the Windows convention), wich is
> OK when shown in a browser, but causes strange multiple empty lines when
> these entries are sent via email.
>
> Can this behaviour be configured, such that simple \n are used for line
> breaks?

I'd assume that PG happily stores what you insert so it's probably a 
client side issue.  Are you inserting from Windows?

Cheers

	robert

[toc] | [prev] | [next] | [standalone]


#418

FromFranz Kruse <Franz.Kruse@t-online.de>
Date2012-10-31 20:58 +0100
Message-ID<k6rvsl$13g$1@news.albasani.net>
In reply to#417
Robert Klemme:

>> We just started to use PostgreSQL. For new table entries (type TEXT) we
>> find line breaks represented as \r\n (the Windows convention), wich is
>> OK when shown in a browser, but causes strange multiple empty lines when
>> these entries are sent via email.
>>
>> Can this behaviour be configured, such that simple \n are used for line
>> breaks?
>
> I'd assume that PG happily stores what you insert so it's probably a
> client side issue.  Are you inserting from Windows?

The inserts take place on a Linux machine in a Perl CGI script that gets 
its data from web forms sent from different computers in the world. A 
test showed that it makes no difference whether the web request comes 
from a Windows machine or a Linux machine. This makes me believe PG 
itself decides to separate text lines with <CR><LF> sequences. Is this a 
standard in PG? Or can the line separator be configured?

Franz

[toc] | [prev] | [next] | [standalone]


#419

Frommattheww@chiark.greenend.org.uk (Matthew Woodcraft)
Date2012-10-31 20:39 +0000
Message-ID<zdj*Cmgju@news.chiark.greenend.org.uk>
In reply to#418
Franz Kruse  <Franz.Kruse@t-online.de> wrote:
> The inserts take place on a Linux machine in a Perl CGI script that gets 
> its data from web forms sent from different computers in the world. A 
> test showed that it makes no difference whether the web request comes 
> from a Windows machine or a Linux machine. This makes me believe PG 
> itself decides to separate text lines with <CR><LF> sequences. Is this a 
> standard in PG? Or can the line separator be configured?

PostgreSQL doesn't really have a concept of a line separator.

Both Linux and Windows web browsers use CRLF line endings when they
send text data entered which has been entered into an HTML form to a
web server.  I expect that's why you're seeing CRLFs.

-M-

[toc] | [prev] | [next] | [standalone]


#421

FromRobert Klemme <shortcutter@googlemail.com>
Date2012-11-01 23:37 +0100
Message-ID<afgbtkF7ruuU1@mid.individual.net>
In reply to#418
On 31.10.2012 20:58, Franz Kruse wrote:
> Robert Klemme:
>
>>> We just started to use PostgreSQL. For new table entries (type TEXT) we
>>> find line breaks represented as \r\n (the Windows convention), wich is
>>> OK when shown in a browser, but causes strange multiple empty lines when
>>> these entries are sent via email.
>>>
>>> Can this behaviour be configured, such that simple \n are used for line
>>> breaks?
>>
>> I'd assume that PG happily stores what you insert so it's probably a
>> client side issue.  Are you inserting from Windows?
>
> The inserts take place on a Linux machine in a Perl CGI script that gets
> its data from web forms sent from different computers in the world. A
> test showed that it makes no difference whether the web request comes
> from a Windows machine or a Linux machine. This makes me believe PG
> itself decides to separate text lines with <CR><LF> sequences. Is this a
> standard in PG? Or can the line separator be configured?

See Matthew's answer.  Believing usually leads to bad results in 
software engineering. :-)  It's better to verify facts - in this case 
actually find out what you actually insert into the database (e.g. via 
degugging or logging).

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

[toc] | [prev] | [next] | [standalone]


#420

FromJasen Betts <jasen@xnet.co.nz>
Date2012-11-01 08:53 +0000
Message-ID<k6tdb1$d54$2@reversiblemaps.ath.cx>
In reply to#416
On 2012-10-30, Franz Kruse <Franz.Kruse@t-online.de> wrote:
> We just started to use PostgreSQL. For new table entries (type TEXT) we 
> find line breaks represented as \r\n (the Windows convention), wich is 
> OK when shown in a browser, but causes strange multiple empty lines when 
> these entries are sent via email.
>
> Can this behaviour be configured, such that simple \n are used for line 
> breaks?

You get out what you put in.


possibly you could use the repalace function to modify the data or the
result.


OTOH \r\n  should bnot be a problem in emails, all the EMAIL RFCs
require \r\n.

-- 
⚂⚃ 100% natural

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [prev] | [standalone]


Back to top | Article view | comp.databases.postgresql


csiph-web