Appended '+' in Column Value

Started by Rich Shepardover 11 years ago8 messagesgeneral
Jump to latest
#1Rich Shepard
rshepard@appl-ecosys.com

One column in a table has values for the attribute 'stream'. Some queries
return some rows where a stream name (only identified one so far) has an
appended '+'. I cannot update the table to remove that appended character,
and I've not seen this before.

Example:

2220 | STV | 2012-07-12 | Nematoda | | |
| | Omnivore | 50 | | StarvationCrk+| Owyhee
| | | | | |
| | | | | |
2701 | STV-10 | 2013-07-10 | Nematoda | | |
| | Omnivore | 36 | | StarvationCrk | Owyhee

I'd appreciate learning where that '+' originates and how to get rid of
it. A query to count the rows with the appendage returns zero:

select count(*) from benthos where stream = 'StarvationCrk';
count
-------
204

select count(*) from benthos where stream = 'StarvationCrk+';
count
-------
0

TIA,

Rich

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Karsten Hilbert
Karsten.Hilbert@gmx.net
In reply to: Rich Shepard (#1)
Re: Appended '+' in Column Value

On Fri, Aug 22, 2014 at 02:46:46PM -0700, Rich Shepard wrote:

One column in a table has values for the attribute 'stream'. Some queries
return some rows where a stream name (only identified one so far) has an
appended '+'. I cannot update the table to remove that appended character,
and I've not seen this before.

Example:

2220 | STV | 2012-07-12 | Nematoda | | |
| | Omnivore | 50 | | StarvationCrk+| Owyhee
| | | | | |
| | | | | |
2701 | STV-10 | 2013-07-10 | Nematoda | | |
| | Omnivore | 36 | | StarvationCrk | Owyhee

I'd appreciate learning where that '+' originates

It's probably an indication of a wrapped column value inside
the display column bounded by |'s.

Try fiddling with \x and \pset.

Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Ian Lawrence Barwick
barwick@gmail.com
In reply to: Rich Shepard (#1)
Re: Appended '+' in Column Value

On 14/08/23 6:46, Rich Shepard wrote:

One column in a table has values for the attribute 'stream'. Some queries
return some rows where a stream name (only identified one so far) has an
appended '+'. I cannot update the table to remove that appended character,
and I've not seen this before.

Example:

2220 | STV | 2012-07-12 | Nematoda | | |
| | Omnivore | 50 | | StarvationCrk+| Owyhee
| | | | | |
| | | | | |
2701 | STV-10 | 2013-07-10 | Nematoda | | |
| | Omnivore | 36 | | StarvationCrk | Owyhee

I'd appreciate learning where that '+' originates and how to get rid of
it. A query to count the rows with the appendage returns zero:

select count(*) from benthos where stream = 'StarvationCrk';
count -------
204

select count(*) from benthos where stream = 'StarvationCrk+';
count -------
0

You have a newline character. Try:

select count(*) from benthos where stream = E'StarvationCrk\n';

Regards

Ian Barwick

--
Ian Barwick http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Rich Shepard (#1)
Re: Appended '+' in Column Value

On 08/22/2014 02:46 PM, Rich Shepard wrote:

One column in a table has values for the attribute 'stream'. Some
queries
return some rows where a stream name (only identified one so far) has an
appended '+'. I cannot update the table to remove that appended character,
and I've not seen this before.

Is this only in psql?

If so I would suspect the table formatting code.

What happens if you do \x and then look at the records?

Example:

2220 | STV | 2012-07-12 | Nematoda | | |
| | Omnivore | 50 | |
StarvationCrk+| Owyhee
| | | | | |
| | | | | |
2701 | STV-10 | 2013-07-10 | Nematoda | | |
| | Omnivore | 36 | | StarvationCrk
| Owyhee

I'd appreciate learning where that '+' originates and how to get rid of
it. A query to count the rows with the appendage returns zero:

select count(*) from benthos where stream = 'StarvationCrk';
count -------
204

select count(*) from benthos where stream = 'StarvationCrk+';
count -------
0

TIA,

Rich

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5Rich Shepard
rshepard@appl-ecosys.com
In reply to: Ian Lawrence Barwick (#3)
Re: Appended '+' in Column Value

On Sat, 23 Aug 2014, Ian Barwick wrote:

You have a newline character. Try:
select count(*) from benthos where stream = E'StarvationCrk\n';

Ian,

Interesting; that query returned 202 of 204 rows.

Thanks,

Rich

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#6Rich Shepard
rshepard@appl-ecosys.com
In reply to: Adrian Klaver (#4)
Re: Appended '+' in Column Value

On Fri, 22 Aug 2014, Adrian Klaver wrote:

Is this only in psql?

Adrian,

Yes.

Thanks,

Rich

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#7Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Rich Shepard (#5)
Re: Appended '+' in Column Value

On 08/22/2014 03:03 PM, Rich Shepard wrote:

On Sat, 23 Aug 2014, Ian Barwick wrote:

You have a newline character. Try:
select count(*) from benthos where stream = E'StarvationCrk\n';

Ian,

Interesting; that query returned 202 of 204 rows.

Yeah, means either whoever inputted the data kept hitting Enter after
each string(most of the time) or whatever program input the data added \n.

Thanks,

Rich

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: Adrian Klaver (#7)
Re: Appended '+' in Column Value

Adrian Klaver <adrian.klaver@aklaver.com> writes:

On 08/22/2014 03:03 PM, Rich Shepard wrote:

On Sat, 23 Aug 2014, Ian Barwick wrote:

You have a newline character. Try:
select count(*) from benthos where stream = E'StarvationCrk\n';

Yeah, means either whoever inputted the data kept hitting Enter after
each string(most of the time) or whatever program input the data added \n.

BTW, see \pset (particularly the linestyle option) in the psql man page
for documentation of this behavior and the options for changing it.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general