Re: Bug involving plus sign before newline in text field being duplicated or stripped

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jon Wedell <wedell(at)bmrb(dot)wisc(dot)edu>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, Dimitri Maziuk <dmaziuk(at)bmrb(dot)wisc(dot)edu>
Subject: Re: Bug involving plus sign before newline in text field being duplicated or stripped
Date: 2019-03-12 17:18:24
Message-ID: 9347.1552411104@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Jon Wedell <wedell(at)bmrb(dot)wisc(dot)edu> writes:
> postgres=# create table test (inchi text);
> CREATE TABLE
> postgres=# insert into test values ('test+
> postgres'# ');
> INSERT 0 1
> postgres=# select * from test;
>  inchi
> -------
>  test++
>  
> (1 row)

Well, that one is not a bug. The character value you inserted is
"t e s t + newline", and when psql renders a value including a
newline, by default it puts a plus at the end of the preceding line.
You can alter that behavior with psql's various \pset options, I believe.

> The second bug is that pyscopg2-binary is stripping a plus sign at the
> end of the value out.

I don't use pyscopg2, but I suspect that you're confusing
the decorative "+" shown by psql with actual data.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jon Wedell 2019-03-12 17:20:10 Re: Bug involving plus sign before newline in text field being duplicated or stripped
Previous Message Alvaro Herrera 2019-03-12 17:08:56 Re: Bug involving plus sign before newline in text field being duplicated or stripped