public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: Rich Shepard <[email protected]>
To: [email protected]
Subject: Re: Finding error in long input file
Date: Tue, 9 Jul 2024 15:29:41 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

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/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?
> 
> 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.


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

then:

bustrac=#\e scripts/insert-addrs.sql

If the editor is vi then:

:488



> 
> TIA,
> 
> Rich
> 
> 
> 

-- 
Adrian Klaver
[email protected]







view thread (12+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Finding error in long input file
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox