Re: pg_service.conf file with iso-8859-1 parameters - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: pg_service.conf file with iso-8859-1 parameters
Date
Msg-id 7E3E2E15-D8EA-4D12-9FB0-718A0B265755@yesql.se
Whole thread Raw
In response to pg_service.conf file with iso-8859-1 parameters  (Magnus Hagander <magnus@hagander.net>)
List pgsql-hackers
> On 11 Sep 2020, at 14:39, Magnus Hagander <magnus@hagander.net> wrote:

> For example, if I have a service file with gssencmode=disable set, that service file cannot be used by a psql client
linkedagainst libpq from version 10. Even if the behavior would be identical (since v10 doesn't have gssencmode). 
>
> Is there a particular reason we (1) refuse unknown parameters in the file,

The above case is a good example when silently ignoring would be beneficial.
We would however run the risk that someone has this in their service which is
silently ignored and fails to notice:

  ssl_mim_protocol_version=TLSv1.3

Not sure if that's worth the risk?  Halting on unknown parameters is also
consistent with postgresql.conf parsing etc (which isn't a clientside file I
know, but still relevant IMO).

> and (2) call it a "syntax error"?

That I agree with isn't entirely correct, the syntax is correct but the
parameter is unknown. Something along the following seems more correct:

  -  libpq_gettext("syntax error in service file \"%s\", line %d\n"),
  +  libpq_gettext("unknown parameter in service file \"%s\", line %d\n"),

> The documentation just says it's "INI format" file -- though in my experience most other INI file parsers just ignore
extraparameters included.. 

I don't think the INI file format is formally defined anywhere, but I do
believe it's considered to be strictly key-values (Wikipedia [0] agrees with
that).  Since we allow ldap configurations like the one below, it's technically
not INI format though:

  [service=mydb]
  ldap://127.0.0.1:10000/foo?bar?lorem?ipsum

That might be borderline hairsplitting, but perhaps calling it INI format in
the docs isn't really helping?  Maybe we should reword that to say key/value or
something similar?

And this brings up an even more interesting case, the above will yield a syntax
error if libpq wasn't compiled with LDAP support, as opposed to other
parameters (like SSL* etc) which are ignored for builds not supporting them.
Is there a reason to treat ldap differently?

cheers ./daniel

[0] https://en.wikipedia.org/wiki/INI_file


pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: [HACKERS] logical decoding of two-phase transactions
Next
From: Ranier Vilela
Date:
Subject: Re: Planner, check if can use consider HASH for groupings (src/backend/optimizer/plan/planner.c)