Re: Finding error in long input file

From: "Ray O'Donnell" <ray(at)rodonnell(dot)ie>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Finding error in long input file
Date: 2024-07-09 22:26:33
Message-ID: 190999b09a8.2834.f9dd809031fc0469edf0bbbf79c1d468@rodonnell.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 9 July 2024 23:14:33 Rich Shepard <rshepard(at)appl-ecosys(dot)com> 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/insert-addrs.sql:488: ERROR: syntax error at or near ";"
> LINE 488: ...2832,1,default,'85250 Red House Rd','Paisley','OR','97636');
> ^ Am
> I correct that some rows were inserted into the table before this error was
> generated somewhere prior to the end of the file? If so, how do I determine
> which rows were inserted and what is the recommended procedure to locate
> just where that error is?

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.

>
> I've learned from experience that using the old coding approach of dividing
> the file in half, then half again and again until the row with the error is
> found produces multiple rows with different PKs. Not what I want to clean
> up.
>
> A clue stick will be much appreciated.
>
> TIA,
>
> Rich

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2024-07-09 22:29:41 Re: Finding error in long input file
Previous Message Rich Shepard 2024-07-09 22:14:13 Finding error in long input file