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 1ubOyS-000Mti-S9 for pgsql-general@arkaria.postgresql.org; Mon, 14 Jul 2025 19:36:29 +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 1ubOyQ-00Cb71-Ur for pgsql-general@arkaria.postgresql.org; Mon, 14 Jul 2025 19:36:27 +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 1ubOyP-00Cb6p-UB for pgsql-general@lists.postgresql.org; Mon, 14 Jul 2025 19:36:27 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ubOyN-007hph-0m for pgsql-general@lists.postgresql.org; Mon, 14 Jul 2025 19:36:26 +0000 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 7A12F1D001AB; Mon, 14 Jul 2025 15:36:20 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Mon, 14 Jul 2025 15:36:20 -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=1752521780; x=1752608180; bh=03A1v9SCuzH88QGH9MyOVPFv2V3YbPxrhTYO4Ck2B7w=; b= V7VPQkUg0fcPnu+DPNX+He8jRMpnj3xKIiiLJvrb8Ac7IUgVuqpSVimLoJtV1aO/ fCB+P6sCJ6w0FDkLXZ7n94/PgZmWFS935AAHimCnAm29PxhPa1aqyqbDC6Dx+JnT fEa3Fa0kE6C9AvD0E3XMQbTD4Eix9jZ3vVBns5gJ5qsEEU5NpGPXp0CPNs8H1Rv6 zSAbAWskLrBnRl8ruqGwV/H72QM3NhoPJbMRr9IYCivppWduTyM16kK3oC3AVSAK s42HmY9yNaG7rWLr8lgojMeN78MMCB8oo2iVQe9kF6qIOSo+F33fpcEYu0TROKpr /CHibA3QCPH2NiXKFh2TJA== 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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1752521780; x=1752608180; bh=0 3A1v9SCuzH88QGH9MyOVPFv2V3YbPxrhTYO4Ck2B7w=; b=UrMI5pNs7aO2lH1rC oArRbYESykKJag2OTF9sUBtHLqzsoHN2vspI5my6hVyICrCM7L4LMv4bIhr+s5Ff rD1MlHqQyHg6Bm+4VXYEZ2n6UcuZrRQJaRsu9uYULvD7OTJzAvNob7ic3W+zW62A xhaUgbL3cgK6ZWYy6Ik2Tb8pnoPRSbAadR3qNN7o/ELft7jkAJclCYCvBOYlwmZq EpxgxF2gxI/UjNwVrmOYT23SzRvyLZ4w5wkFfqQHSwMb1i+0Gs6RP9U0NCob1sYt N62WUyH0RJu4+e3WL3DzRIRBiCCT0cEUS+Hpnx7KgNGDuMo8QfBvynN8bA9kwnCS Us19A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdehvdektdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeetughrihgrnhcu mfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqne cuggftrfgrthhtvghrnhepffelgeeifefgveduhedthfekuedtffejveegffegjeevtdeh gfduieetfeehjeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhdpnhgspghr tghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprhhshhgvphgrrh gusegrphhplhdqvggtohhshihsrdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgv rhgrlheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Jul 2025 15:36:19 -0400 (EDT) Message-ID: <7ec33517-6dc1-4e1d-b741-0c26eba7cc79@aklaver.com> Date: Mon, 14 Jul 2025 12:36:19 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Syntax error needs explanation To: Rich Shepard , pgsql-general@lists.postgresql.org References: <9c84776d-d938-9fa4-ab1-6ee960ce6e7d@appl-ecosys.com> Content-Language: en-US From: Adrian Klaver In-Reply-To: <9c84776d-d938-9fa4-ab1-6ee960ce6e7d@appl-ecosys.com> 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/14/25 12:12, Rich Shepard wrote: > I have the following script: > > select c.company_nbr, c.company_name, i.industry, from companies as c, > industry as i, enforcement as e > where exists ( >   select c.company_nbr, count(e.action_date), sum(e.penalty_amt) >   from e.enforcement >   where c.company_nbr = e.company_nbr >   ) > group by industry > order by industry; > > When I run it psql reports an error: > psql:companies-with-enforcement-actions.txt:127: ERROR:  syntax error at > or near "company_nbr" > LINE 1: company_nbr |               company_name The above looks like the format 'aligned' output from a query. When you did \0 you captured that. As example: production=# \o test.sql production=# select * from cell_per; production=# \e test.sql line_id | category | cell_per | ts_insert | ts_update | user_insert | user_update | plant_type | season | short_category [...] >         ^ > and I'm not seeing the error. What am I missing? > > TIA, > > Rich > > -- Adrian Klaver adrian.klaver@aklaver.com