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.kla...@aklaver.com