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 1sRJLL-00EQNv-B6 for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2024 22:29:51 +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 1sRJLJ-000Fze-UB for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2024 22:29:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRJLI-000FzW-FF for pgsql-general@lists.postgresql.org; Tue, 09 Jul 2024 22:29:49 +0000 Received: from fout6-smtp.messagingengine.com ([103.168.172.149]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRJLF-001GvF-2Q for pgsql-general@postgresql.org; Tue, 09 Jul 2024 22:29:46 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfout.nyi.internal (Postfix) with ESMTP id 9263D13808F9; Tue, 9 Jul 2024 18:29:43 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 09 Jul 2024 18:29:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1720564183; x=1720650583; bh=mPVOXZT3BpvykyiU/oX564OdPsPCmNS/YfiYC/FJsd0=; b= GjmiEO8yZ1/kndnF7/oKl6YdFEw7MLiCMfilqktUbRfTUOABJ7ehdcOwTsZjvH0X y884qvihbv6ubFCq0p4Is50p6EH1tVlW9vr1I2ca474WrzR1Db4JF8ITrh3hZClk QewHjU6VwkGwvGt8e489TBWiARt7GdocOu6j5pPLHAsGznVBmUrXi2KmygF7pwCf SI/8xNaw+qrH1Ds+QsimB+6PDT3S+tgt1ITrh9zSUveu+FnoUtK8G2JpURl1crVl V//Rl8L002DYvKd8yFT0kPv8VeU6yz5wn4PMeiEWmEelPytmJGnEolZq8d+B9UNU LbjWn7slBpdieg1cXbHMCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1720564183; x= 1720650583; bh=mPVOXZT3BpvykyiU/oX564OdPsPCmNS/YfiYC/FJsd0=; b=L r9gcUiXZEghK+mbLcD++9rHg6/TXVikzO7UINI4pF4FC6pExyKXzbYiM4pHpcV0K nBt8VvtFiPVX7JDtwqABljkS9jl0UB7UP2kMZRwlDmOFgzyhllpIi94i77fW7tTI /PtuOrMfndMeFXQOLRa+GcoCDNHlRXzBrnJc20C3pNT66Mp6BIv1JwhiOzeIgeTq jVXp5M5nuV80zW/jU4JRgqRFGmMVNwsV8XkdAkz84F2Qh/7KKYGn6J02MHhDnCI2 83QliVRLSzzuXTqqkQal8Z9onP2pPROGJ1/bacAS+GGerJhRIffN9FP2lDSMLuNN f6Nrn1GkCO6Yw7Z6j+W2Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrfedtgdduudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepffelgeeifefgveduhedthfekuedtffejveegffegjeev tdehgfduieetfeehjeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 9 Jul 2024 18:29:41 -0400 (EDT) Message-ID: <71cf3e97-a0a5-4a94-add8-989cd1e2311d@aklaver.com> Date: Tue, 9 Jul 2024 15:29:41 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Finding error in long input file To: Rich Shepard , pgsql-general@postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 adrian.klaver@aklaver.com