Обсуждение: Error message against iso-8859-1 key in pg_service.conf is unclear

Поиск
Список
Период
Сортировка

Error message against iso-8859-1 key in pg_service.conf is unclear

От
Chao Li
Дата:
Hi Hacker,

I noticed that, if I put a wrong kay name in pg_service.conf, the error message is “syntax error”.

For example, I created $HOME/.pg_service.conf:
```
[test]
default = true
```

“Default” is not a valid key name, then I got:
```
% PGSERVICE=test psql -d evantest
psql: error: syntax error in service file "/Users/chaol/.pg_service.conf", line 2
```

The error message showed the correct line number, but “syntax error” is confusing. Shouldn’t it be something like
“invalidconfiguration parameter: default”? 

By contrast, If I put a correct key name with a wrong value, the error message is clear, the error message is:
```
% PGSERVICE=test psql -d evantest
psql: error: invalid sslmode value: "disabled"
```

Is that something can be enhanced?

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







Re: Error message against iso-8859-1 key in pg_service.conf is unclear

От
Jacob Champion
Дата:
On Wed, Oct 15, 2025 at 7:30 PM Chao Li <li.evan.chao@gmail.com> wrote:
> The error message showed the correct line number, but “syntax error” is confusing. Shouldn’t it be something like
“invalidconfiguration parameter: default”? 

I think so; see patch 0003 in [1].

--Jacob

[1] https://postgr.es/m/CAOYmi%2BkYKPXCfiAF3xAu%2BcHYSLYEc4OC9Wsh2nebwWboNbkpeQ%40mail.gmail.com



Re: Error message against iso-8859-1 key in pg_service.conf is unclear

От
Chao Li
Дата:

> On Oct 17, 2025, at 00:27, Jacob Champion <jacob.champion@enterprisedb.com> wrote:
>
> On Wed, Oct 15, 2025 at 7:30 PM Chao Li <li.evan.chao@gmail.com> wrote:
>> The error message showed the correct line number, but “syntax error” is confusing. Shouldn’t it be something like
“invalidconfiguration parameter: default”? 
>
> I think so; see patch 0003 in [1].
>
> --Jacob
>
> [1] https://postgr.es/m/CAOYmi%2BkYKPXCfiAF3xAu%2BcHYSLYEc4OC9Wsh2nebwWboNbkpeQ%40mail.gmail.com

Cool! So, patch 0003 should more likely belong to this discussion. :)

I reviewed and tested 0003. But I failed to “git am” it, maybe need a rebase. So I manually applied the change to my
local.

The change looks good to me. And the new TAP test also passed in my side. I think we can push this patch separately.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/