Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-17 Thread Rich Shepard
On Fri, 16 Sep 2011, Andy Colson wrote: Sorry, I should have been a little more clear, but, at least you got things cleaned up. PG has a huge number of data manipulation functions. If you have to export data out of a database in order to massage it, then that's a failure of a database. PG (and

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-16 Thread Andy Colson
On 09/16/2011 04:42 PM, Rich Shepard wrote: On Thu, 15 Sep 2011, Andy Colson wrote: First you need to trim the \n and spaces: andy=# insert into junk values (E'GW-22'); INSERT 0 1 andy=# insert into junk values (E'GW-22 \n'); INSERT 0 1 andy=# insert into junk values (E'GW-22 \n'); Andy, He

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump [SOLVED]

2011-09-16 Thread Rich Shepard
On Fri, 16 Sep 2011, Rich Shepard wrote: Scrolling through the table with rows ordered by date and chemical I find no duplicates ... so far. However, what I do find is that the above did not work: Turns out there was 1 duplicate. Reading the psql man page and making an error in the \copy co

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-16 Thread Rich Shepard
On Thu, 15 Sep 2011, Andy Colson wrote: Trim it up: andy=# select '['|| rtrim(trim(trailing E'\n' from a)) || ']' from junk; Andy, Scrolling through the table with rows ordered by date and chemical I find no duplicates ... so far. However, what I do find is that the above did not work: GW

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-16 Thread Rich Shepard
On Thu, 15 Sep 2011, Andy Colson wrote: First you need to trim the \n and spaces: andy=# insert into junk values (E'GW-22'); INSERT 0 1 andy=# insert into junk values (E'GW-22 \n'); INSERT 0 1 andy=# insert into junk values (E'GW-22 \n'); Andy, Here's what worked for me: nevada=# \

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-15 Thread Alban Hertroys
On 16 September 2011 03:31, Adrian Klaver wrote: > This is one of those things I find spreadsheets actually useful for. Do a > COPY or > /copy, in CSV format from the table and import it into a spreadsheet. I > find the > grid layout of a spreadsheet very useful in picking out misplaced fields. >

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-15 Thread Adrian Klaver
On Thursday, September 15, 2011 1:17:06 pm Rich Shepard wrote: > On Thu, 15 Sep 2011, Alban Hertroys wrote: > > You appear to have two tabs after "Depth to Water", which would be one > > too many. > > Alban, > >I thought that I had caught all the double tabs. Thanks for seeing this > one. >

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-15 Thread Rich Shepard
On Thu, 15 Sep 2011, Andy Colson wrote: It's simpler to use sql to do this. Can you restore the table? Andy, OK. I need to provide a new client with filled in paperwork so I can get paid. I'll return to this as soon as that's done. Yes, I'll restore from the backup drive (yea, dirvish!)

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-15 Thread Andy Colson
On 9/15/2011 3:17 PM, Rich Shepard wrote: On Thu, 15 Sep 2011, Alban Hertroys wrote: You appear to have two tabs after "Depth to Water", which would be one too many. Alban, I thought that I had caught all the double tabs. Thanks for seeing this one. Now I'm back to the tabs-in-real-columns

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-15 Thread Andy Colson
On 9/15/2011 3:10 PM, Rich Shepard wrote: On Thu, 15 Sep 2011, Andy Colson wrote: To restore, you are using: psql dbname < filename correct? Andy, Same error. BTW, what prompted this was my discovery that about 1400 rows with site_id = GW-22 had a newline appended to that string. Using emac

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-15 Thread Rich Shepard
On Thu, 15 Sep 2011, Alban Hertroys wrote: You appear to have two tabs after "Depth to Water", which would be one too many. Alban, I thought that I had caught all the double tabs. Thanks for seeing this one. Now I'm back to the tabs-in-real-columns issue: ERROR: invalid input syntax f

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-15 Thread Rich Shepard
On Thu, 15 Sep 2011, Andy Colson wrote: Ah, I see there was a prior thread about this problem. You said you'd missed the \. and said it was resolved. So is this a same file or a different one? Andy, Same file, unfortunately. Rich -- Sent via pgsql-general mailing list (pgsql-general@pos

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-15 Thread Rich Shepard
On Thu, 15 Sep 2011, Andy Colson wrote: To restore, you are using: psql dbname < filename correct? Andy, Same error. BTW, what prompted this was my discovery that about 1400 rows with site_id = GW-22 had a newline appended to that string. Using emac's search-and-replace I took those off

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-15 Thread Alban Hertroys
On 15 Sep 2011, at 19:31, Rich Shepard wrote: > The .sql file produced by pg_dump is properly terminated with '\.' as the > last line, yet I continue to encounter this error: > > ERROR: invalid input syntax for type real: " " > CONTEXT: COPY chemistry, line 47363, column quant: " " >

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-15 Thread Andy Colson
On 9/15/2011 2:38 PM, Rich Shepard wrote: On Thu, 15 Sep 2011, Andy Colson wrote: Can you pg_dump again, but use --inserts? Maybe it'll offer some hints. Andy, Only if I restore /usr/local/pgsql/data/* from the backup tape of a few days ago. I need to drop the table before trying to insert i

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-15 Thread Rich Shepard
On Thu, 15 Sep 2011, Andy Colson wrote: Can you pg_dump again, but use --inserts? Maybe it'll offer some hints. Andy, Only if I restore /usr/local/pgsql/data/* from the backup tape of a few days ago. I need to drop the table before trying to insert it. Also, do you have the right line en

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump

2011-09-15 Thread Andy Colson
On 9/15/2011 12:31 PM, Rich Shepard wrote: The .sql file produced by pg_dump is properly terminated with '\.' as the last line, yet I continue to encounter this error: ERROR: invalid input syntax for type real: " " CONTEXT: COPY chemistry, line 47363, column quant: " " when trying to re-create

Re: [GENERAL] Apparent Problem With NULL in Restoring pg_dump [UPDATE]

2011-09-15 Thread Rich Shepard
On Thu, 15 Sep 2011, Rich Shepard wrote: It appears that this error is generated when a row has a missing value in the 'quant' column and the column contains '\N' in the text file. For example, \N GW-22 2005-03-09 Depth to Water \N Feet\N \N \N \N So