Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRJ6L-00EPGI-8X for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2024 22:14:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sRJ6I-0008T0-UG for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2024 22:14:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRJ6I-0008Sr-JJ for pgsql-general@lists.postgresql.org; Tue, 09 Jul 2024 22:14:18 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRJ6G-001Hx8-7W for pgsql-general@postgresql.org; Tue, 09 Jul 2024 22:14:17 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 94E182A2B7C for ; Tue, 9 Jul 2024 15:14:13 -0700 (PDT) Date: Tue, 9 Jul 2024 15:14:13 -0700 (PDT) From: Rich Shepard Reply-To: Rich Shepard To: pgsql-general@postgresql.org Subject: Finding error in long input file Message-ID: MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. TIA, Rich