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 1sRRHG-00FM5v-76 for pgsql-general@arkaria.postgresql.org; Wed, 10 Jul 2024 06:58:10 +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 1sRRHE-002f2g-R8 for pgsql-general@arkaria.postgresql.org; Wed, 10 Jul 2024 06:58:08 +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 1sRRHE-002f2Y-G9 for pgsql-general@lists.postgresql.org; Wed, 10 Jul 2024 06:58:08 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sRRHB-001KaM-JG for pgsql-general@postgresql.org; Wed, 10 Jul 2024 06:58:07 +0000 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a77e2f51496so488267366b.0 for ; Tue, 09 Jul 2024 23:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720594684; x=1721199484; darn=postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lvV/Gw3rNG6b3FGTZeqWj32+hfHZJagfek8cBC5leT8=; b=TrWjjCfg29LllBbusXwWH3CHJiJGBUeTyMYmEglnPxGUFBX1MsuFcegCHGNdJsNC9+ yDegh4R764WGlXe3F07SuVYKIpoePnlC/wnOYIy/crRK3Q8cauzZ74Af+OKg1riR+3yG dyly7UQCryxjissC5O9RIgE7jZsqBRE9zuRvI0uH95TjGlYk3Gg7QNHVG7ikhKILgnKk zQa8bWe1AfLaueX886rvnCztqi/FK8EFFZyCeyKgqdk0pvpOgXUczOhKZfEtvZllY6I4 g3nvp0fzt8nS+WYh/FI5FI6nqjFuFLK1a38tJAxAfu5g7/AyWdXp8ApLWqWJMwcCyBo0 tlCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720594684; x=1721199484; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lvV/Gw3rNG6b3FGTZeqWj32+hfHZJagfek8cBC5leT8=; b=c3RCdPfQMf/Y2jVIiHp0tEUbBRkEOm0aKVB798CV0U1xyOPWicrHJXyfpzw0jJ1khs p4OJ4kcLuYOyd+WCZmvBbtAlAMOcP+cNMprmuQ/O3oV/tmehDThUyYa/wzrvY4M7WuUF 9sV1a/RETYz3v5CN9bx6JzL+Rq1gSzg/pKtCXmy7FWMQyvG8uH/J7j0J4tToc5ooHTLV bliJVxAx8ddMesfAYMDh+Zgo64+RSfzEuOCiTbOXKaLszwrdD3AIJL+UBsbU6NDqvHcq LlJw9F2YP4+ziS7Wt+XhoonqsCOmOVKZPH/KVZDuCeQ334P1ly8ax+EEFD1vGyULu1U0 XYsg== X-Forwarded-Encrypted: i=1; AJvYcCV34s/g+lUF8V1+uQQxbxz7nnwkP02GsG3J7XSBo8LMkWSLO2TnnhIYKftsOxySwemdtRe+2NjQMylR273w100r4+izPxvJODlvApRm X-Gm-Message-State: AOJu0Yz+QexawJzrqAoCrhCxCG8tgFdJX7W/usvSdUWPDpWRBerYXeER 4/pyM/vmmOLlL9QZAVQ6RjT525fAp+IOjLkmqWFFRXpPA2zrO0G+ X-Google-Smtp-Source: AGHT+IHmGRvNeSbJawLNllwtev4L2m9D+6G6s1okQKh+T9fuB68r2U8dAu5rH4487qWdpA4W1H0pLg== X-Received: by 2002:a17:906:50c:b0:a77:c6c4:2bb7 with SMTP id a640c23a62f3a-a780b68a8c6mr297584066b.1.1720594683642; Tue, 09 Jul 2024 23:58:03 -0700 (PDT) Received: from smtpclient.apple ([188.212.112.125]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a87207fsm132378466b.219.2024.07.09.23.58.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jul 2024 23:58:03 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: Finding error in long input file From: Alban Hertroys In-Reply-To: <155fc2ec-d936-4838-b4dd-ca7d06acb6a1@aklaver.com> Date: Wed, 10 Jul 2024 08:57:52 +0200 Cc: Craig McIlwee , Rich Shepard , pgsql-general@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <71cf3e97-a0a5-4a94-add8-989cd1e2311d@aklaver.com> <155fc2ec-d936-4838-b4dd-ca7d06acb6a1@aklaver.com> To: Adrian Klaver X-Mailer: Apple Mail (2.3774.600.62) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 10 Jul 2024, at 06:58, Adrian Klaver = wrote: >=20 > 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 of a coincidence that = the last character of the last line is really the error. My guess is = that there=20 >=20 > This assumes that there where only INSERT lines and that each INSERT = was only one line. I have bit by those assumptions before, hence my = suggestion to actually find line 488. >=20 >> is an unmatched character, perhaps a parenthesis, that is throwing = off the parser because it doesn't expect the statement to terminate yet. = Maybe that unmatched char really is on the last line, but '85250 Red = House Rd' doesn't seem like the issue. I don't know anything about the = joe editor, but I'd hope that any decent editor with syntax highlighting = would make it apparent where things went awry. >> Craig >=20 Is this a single INSERT statement with multiple tuples after VALUES? = Then perhaps an earlier line (my bet would be on line 487) 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.