Re: Syntax error needs explanation

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Syntax error needs explanation
Date: 2025-07-14 19:36:19
Message-ID: 7ec33517-6dc1-4e1d-b741-0c26eba7cc79@aklaver.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2025-07-14 19:45:45 Re: Syntax error needs explanation
Previous Message Rich Shepard 2025-07-14 19:19:44 Re: Syntax error needs explanation [RESOLVED]