Rich: On Sun, Nov 1, 2020 at 8:04 PM Rich Shepard <rshepard@xxxxxxxxxxxxxxx> wrote: > > On Sun, 1 Nov 2020, Francisco Olarte wrote: > > > This is nearly impossible to diagnose without a chunk of the query ( > > i,e, the first lines and the last ones ). > Francisco, > $ psql -d bustrac -f locations.sql This is NOT the first line of the query. Even "head locations.sql" is not guaranteed to give the first line of the query ( you know it, we do not, it may have a few selects ata the top. What I mean is something like .... >>>>>>>> insert into locations balh, blerg, blub values (1,2,3), ...... snip the middle lines. (4,5,6), (7,8,9); <<<<<<<<<<<< > > It smells to missing parentheses. If you use some editor witch matches > > them, try adding one BEFORE the semicolon. If it matches something > > above you've got it. > Here're the last two lines: > (2297,1,'Principal place of business','600 SE Bay Boulevard',null,'Newport','OR','97365','541-265-7758','541-265-4235',null), > (2298,1,'Principal place of business','7200 NE Airport Way',null,'Portland','OR','97218',null,null,null); > And psql found a few missing terminating parentheses and commas which were > fixed. I expected this last run to successfully complete. Good luck. BTW, if you know a bit of scripting in perl/awk/python whatever, it's normally useful to generate big insertion queries programatically, to avoid mismatched quotes problems. And if your editor is half-decent ad you have th disk space you can normally try to make a big file, create an empty table like the target one, insert into so you can bisect the input ( and once you have everything in spool tables you just insert the whole table into the final one and drop it ). I mean, you do "create table location_tmp like locations". Then, split your input files into easily managed ones, say some thousand lines. Insert every file into tmp, do bisections on the ones which fail to find errors. Once you have everything in tmp just insert from it into final table. Francisco Olarte.