Re: Finding error in long input file

2024-07-10 Thread Rich Shepard
On Wed, 10 Jul 2024, Rob Sargent wrote: I'm an emacs user too. Do you have show-paren enabled? This would show that your file was ill-formed. M-p and M-n go previous/next matching parentheses of all types. Rob, No, I haven't enabled show-paren. Thanks for the tip, Rich

Re: Finding error in long input file

2024-07-10 Thread Rich Shepard
On Wed, 10 Jul 2024, David G. Johnston wrote: My first easy look for this setup is for any single quotes not adjacent to either a comma or a parenthesis. Syntax highlighting should ideally have caught this but I’d look anyway. David, I found an error on line 21 that I missed seeing every tim

Re: Finding error in long input file

2024-07-10 Thread David G. Johnston
On Wednesday, July 10, 2024, Rich Shepard wrote: > On Wed, 10 Jul 2024, David G. Johnston wrote: > > And what are the first few lines of the file? Use text, not screenshots. >> > > David, > > insert into locations (company_nbr,loc_nbr,loc_name, > addr1,city,state_code,postcode) values > (2564,1,d

Re: Finding error in long input file

2024-07-10 Thread Adrian Klaver
On 7/10/24 05:30, Rich Shepard wrote: On Tue, 9 Jul 2024, Adrian Klaver wrote: The error: LINE 488: ...2832,1,default,'85250 Red House Rd','Paisley','OR','97636') is giving you the line number and the data: a) Navigate to that line number using whatever method Joe has for that. b) Search for

Re: Finding error in long input file

2024-07-10 Thread Rich Shepard
On Wed, 10 Jul 2024, Hans Schou wrote: If the file has these line breaks you show, then can make it to multiple 'INSERT INTO' instead. Hans, I thought of that, but forgot it. This makes more sense than dividing the file in small chunks. Thanks, Rich

Re: Finding error in long input file

2024-07-10 Thread Rich Shepard
On Wed, 10 Jul 2024, David G. Johnston wrote: And what are the first few lines of the file? Use text, not screenshots. David, insert into locations (company_nbr,loc_nbr,loc_name,addr1,city,state_code,postcode) values (2564,1,default,'4250 Hopkins Rd','Ontario','OR','97914'), (2565,1,default,

Re: Finding error in long input file

2024-07-10 Thread Hans Schou
On Wed, Jul 10, 2024 at 2:59β€―PM David G. Johnston < david.g.johns...@gmail.com> wrote: > > And what are the first few lines of the file? Use text, not screenshots. > Yes the line with 'INSERT' grep -ni 'INSERT INTO' scripts/insert-addrs.sql -- π•³π–†π–“π–˜ π•Ύπ–ˆπ–π–”π–š ☏ ➁➁ βž…βžƒ βž‡β“ͺ ➁β“ͺ

Re: Finding error in long input file

2024-07-10 Thread Hans Schou
If the file has these line breaks you show, then can make it to multiple 'INSERT INTO' instead. Search for lines starting with parentese begin '(' and replace it with the correct INSERT and last comma to semi-colon: cat i.sql | sed -e 's/^(/INSERT INTO foo VALUES(/' -e 's/,$/;/' Does the file c

Re: Finding error in long input file

2024-07-10 Thread David G. Johnston
On Wednesday, July 10, 2024, Rich Shepard wrote: > > Partial screenshot attached. And what are the first few lines of the file? Use text, not screenshots. David J.

Re: Finding error in long input file

2024-07-10 Thread Rich Shepard
On Tue, 9 Jul 2024, Craig McIlwee wrote: The input file is 488 lines (presumably, since Rich said the file should insert 488 rows). It seems like too much of a coincidence that the last character of the last line is really the error. My guess is that there is an unmatched character, perhaps a pa

Re: Finding error in long input file

2024-07-10 Thread Rich Shepard
On Tue, 9 Jul 2024, Adrian Klaver wrote: The error: LINE 488: ...2832,1,default,'85250 Red House Rd','Paisley','OR','97636') is giving you the line number and the data: a) Navigate to that line number using whatever method Joe has for that. b) Search for '85250 Red House Rd'. Adrian, With t

Re: Finding error in long input file

2024-07-09 Thread Alban Hertroys
> On 10 Jul 2024, at 06:58, Adrian Klaver wrote: > > On 7/9/24 17:46, Craig McIlwee wrote: >> Full error message from earlier in the thread: >> > psql:scripts/insert-addrs.sql:488: ERROR: syntax error at or near ";" >> > LINE 488: ...2832,1,default,'85250 Red House Rd','Paisley','OR','97636');

Re: Finding error in long input file

2024-07-09 Thread Adrian Klaver
On 7/9/24 17:46, Craig McIlwee wrote: Full error message from earlier in the thread: > psql:scripts/insert-addrs.sql:488: ERROR:Β  syntax error at or near ";" > LINE 488: ...2832,1,default,'85250 Red House Rd','Paisley','OR','97636'); >

Re: Finding error in long input file

2024-07-09 Thread Craig McIlwee
Full error message from earlier in the thread: > psql:scripts/insert-addrs.sql:488: ERROR: syntax error at or near ";" > LINE 488: ...2832,1,default,'85250 Red House Rd','Paisley','OR','97636'); > ^ The error: > > LINE 488

Re: Finding error in long input file

2024-07-09 Thread Adrian Klaver
On 7/9/24 15:40, Rich Shepard wrote: On Tue, 9 Jul 2024, Adrian Klaver wrote: bustrac=#\e scripts/insert-addrs.sql 488 If that raises this error: environment variable PSQL_EDITOR_LINENUMBER_ARG must be set to specify a line number Adrian, It doesn't; it prints the contents of the file to th

Re: Finding error in long input file

2024-07-09 Thread Rich Shepard
On Tue, 9 Jul 2024, Rich Shepard wrote: Should I run BEGIN: at the psql prompt prior to entering the insert command? Would that tell me if any rows were entered and, if so, where that stopped? Began a transction, ran the script, checked the locations table for a couple of rows to be inserted.

Re: Finding error in long input file

2024-07-09 Thread Rich Shepard
On Tue, 9 Jul 2024, Adrian Klaver wrote: bustrac=#\e scripts/insert-addrs.sql 488 If that raises this error: environment variable PSQL_EDITOR_LINENUMBER_ARG must be set to specify a line number Adrian, It doesn't; it prints the contents of the file to the virtual terminal. Using my default s

Re: Finding error in long input file

2024-07-09 Thread Rich Shepard
On Tue, 9 Jul 2024, Ray O'Donnell wrote: Did you run the entire thing inside a transaction? If so, then it will have been rolled back after the error, and no rows will have been inserted. Ray, When I tried using transactions they froze the application. Probably because I don't know to properl

Re: Finding error in long input file

2024-07-09 Thread Adrian Klaver
On 7/9/24 15:14, Rich Shepard wrote: I've a file with 488 rows to be input into a table. I run the script using psql with the `\i' option. After psql found a few missing commas I thought the script was clean. But, psql returned this error: bustrac=# \i scripts/insert-addrs.sql psql:scripts/inser

Re: Finding error in long input file

2024-07-09 Thread Ray O'Donnell
On 9 July 2024 23:14:33 Rich Shepard wrote: I've a file with 488 rows to be input into a table. I run the script using psql with the `\i' option. After psql found a few missing commas I thought the script was clean. But, psql returned this error: bustrac=# \i scripts/insert-addrs.sql psql:scr

Finding error in long input file

2024-07-09 Thread Rich Shepard
I've a file with 488 rows to be input into a table. I run the script using psql with the `\i' option. After psql found a few missing commas I thought the script was clean. But, psql returned this error: bustrac=# \i scripts/insert-addrs.sql psql:scripts/insert-addrs.sql:488: ERROR: syntax error