Re: Syntax error needs explanation

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Syntax error needs explanation
Дата
Msg-id 7ec33517-6dc1-4e1d-b741-0c26eba7cc79@aklaver.com
обсуждение исходный текст
Ответ на Syntax error needs explanation  (Rich Shepard <rshepard@appl-ecosys.com>)
Список 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.klaver@aklaver.com




В списке pgsql-general по дате отправления: