Re: Finding error in long input file

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Finding error in long input file
Дата
Msg-id C59A0E87-41F5-496D-8C61-F2B6D6D78786@gmail.com
обсуждение исходный текст
Ответ на Re: Finding error in long input file  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
> On 10 Jul 2024, at 06:58, Adrian Klaver <adrian.klaver@aklaver.com> 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');
>> >                                                                           ^
>>    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'.
>> The input file is 488 lines (presumably, since Rich said the file should insert 488 rows).  It seems like too much
ofa coincidence that the last character of the last line is really the error.  My guess is that there  
>
> This assumes that there where only INSERT lines and that each INSERT was only one line. I have bit by those
assumptionsbefore, hence my suggestion to actually find line 488. 
>
>> is an unmatched character, perhaps a parenthesis, that is throwing off the parser because it doesn't expect the
statementto terminate yet.  Maybe that unmatched char really is on the last line, but '85250 Red House Rd' doesn't seem
likethe issue.  I don't know anything about the joe editor, but I'd hope that any decent editor with syntax
highlightingwould make it apparent where things went awry. 
>> Craig
>

Is this a single INSERT statement with multiple tuples after VALUES? Then perhaps an earlier line (my bet would be on
line487) accidentally ends with a semi-colon instead of a comma? 

Something like this:

INSERT INTO table (col1, col2, ..., coln) VALUES
(..., ..., ),
(..., ..., ),
(..., ..., ); -- <-- This terminates the INSERT
(..., ..., ); -- <-- Now this line make no sense



Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.




В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Finding error in long input file
Следующее
От: vimal va
Дата:
Сообщение: Postgres :- Could not open R2DBC Connection