Error message against unknown key in pg_service.conf is unclear

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Error message against unknown key in pg_service.conf is unclear
Date: 2025-10-16 02:29:41
Message-ID: 305B1E2D-3E35-410B-A840-53F62EDF5045@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 “invalid configuration 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/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-10-16 02:36:36 Re: [BUG] temporary file usage report with extended protocol and unnamed portals
Previous Message Chao Li 2025-10-16 02:16:18 Re: Thoughts on a "global" client configuration?