Re: [GENERAL] Identifying Reason for Column Name Returned by SELECT

2011-09-14 Thread Rich Shepard
On Wed, 14 Sep 2011, Merlin Moncure wrote: It *is* mult-line. psql uses a '+ to show line breaks: Merlin, Yep. I discovered this when I dumped the table as an ASCII text file and saw the '\n' after the site_id string on some rows. I've no idea how it got there. Thanks, Rich -- Sent via

Re: [GENERAL] Identifying Reason for Column Name Returned by SELECT

2011-09-14 Thread Merlin Moncure
On Wed, Sep 14, 2011 at 12:04 PM, Rich Shepard wrote: > On Wed, 14 Sep 2011, Steve Crawford wrote: > >> I suspect you have a multi-line entry and the '+' is just indicating that >> the field continues. > > Steve, et al.: > >  It's not multi-line, but malformed. It *is* mult-line. psql uses a '+

Re: [GENERAL] Identifying Reason for Column Name Returned by SELECT

2011-09-14 Thread Rich Shepard
On Wed, 14 Sep 2011, Richard Broersma wrote: I'm confused. Richard, Apparently, I am also confused. Doing too many things simultaneoulsy. Do you want to UPDATE the affected records to GW-22. Or do you want to ALTER the table to add a column constraint to prevent malformed site_id's in the

Re: [GENERAL] Identifying Reason for Column Name Returned by SELECT

2011-09-14 Thread Richard Broersma
On Wed, Sep 14, 2011 at 10:04 AM, Rich Shepard wrote: >  This found the appropriate rows. Now, my question is DDL-related: > >  What is the appropriate syntax to change 'GW-22  +' to GW-22? Can I use > 'like' or '~' in an ALTER TABLE RENAME ... statement? I'm confused. Do you want to UPDATE th

Re: [GENERAL] Identifying Reason for Column Name Returned by SELECT

2011-09-14 Thread Rich Shepard
On Wed, 14 Sep 2011, Steve Crawford wrote: I suspect you have a multi-line entry and the '+' is just indicating that the field continues. Steve, et al.: It's not multi-line, but malformed. Try ...where site_id ~ 'GW-22'... (this may take a while if the table is very large). This found

Re: [GENERAL] Identifying Reason for Column Name Returned by SELECT

2011-09-14 Thread Darren Duncan
Darren Duncan wrote: Try "like" by default, such as "where site_id like 'GW-22 %'". I added the space between the 22 and the wildcard % so that the field containing just 'GW-22' isn't also matched. Sorry, I should have said "where site_id like 'GW-22%' and site_id != 'GW-22'" (no explicit sp

Re: [GENERAL] Identifying Reason for Column Name Returned by SELECT

2011-09-14 Thread Richard Broersma
On Wed, Sep 14, 2011 at 9:42 AM, Steve Crawford wrote: > I suspect you have a multi-line entry and the '+' is just indicating that > the field continues. > > Try ...where site_id ~ 'GW-22'... (this may take a while if the table is > very large). You might be able to get an index scan if you incl

Re: [GENERAL] Identifying Reason for Column Name Returned by SELECT

2011-09-14 Thread Darren Duncan
Your example suggests that the "GW-22" is a substring of the field followed by trailing spaces so you'll want something that searches substrings, whereas "=" will always just test on matching the entire field. Try "like" by default, such as "where site_id like 'GW-22 %'". I added the space be

Re: [GENERAL] Identifying Reason for Column Name Returned by SELECT

2011-09-14 Thread Steve Crawford
I suspect you have a multi-line entry and the '+' is just indicating that the field continues. Try ...where site_id ~ 'GW-22'... (this may take a while if the table is very large). Cheers, Steve On 09/14/2011 09:35 AM, Rich Shepard wrote: I run this SELECT statement on a table: select

[GENERAL] Identifying Reason for Column Name Returned by SELECT

2011-09-14 Thread Rich Shepard
I run this SELECT statement on a table: select distinct(site_id) from chemistry order by site_id; and in the returned set I see: GW-21 GW-22 GW-22 + GW-24 I want to find that row returning 'GW-22 +' because I believe it should be 'GW-23'. However, my attempts to retrieve