Thread: keywords in initdb are case-sensitive?

keywords in initdb are case-sensitive?

From
Alvaro Herrera
Date:
In miracee's review of Peter's patch for new -A options in initdb (in
commitfest app only), it is noted that pg_hba.conf keyword parsing is
done in a case sensitive manner.  So if you write "Trust" rather than
"trust", it's not recognized.

This seemed pretty nonsensical to me, and it's not documented, so I came
up with the trivial attached patch.

Comparisons to user and database names and the like are unchanged and
thus require matching case.

Thoughts?

--
Álvaro Herrera <alvherre@alvh.no-ip.org>

Attachment

Re: keywords in initdb are case-sensitive?

From
Robert Haas
Date:
On Wed, Feb 1, 2012 at 11:45 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> In miracee's review of Peter's patch for new -A options in initdb (in
> commitfest app only), it is noted that pg_hba.conf keyword parsing is
> done in a case sensitive manner.  So if you write "Trust" rather than
> "trust", it's not recognized.
>
> This seemed pretty nonsensical to me, and it's not documented, so I came
> up with the trivial attached patch.
>
> Comparisons to user and database names and the like are unchanged and
> thus require matching case.
>
> Thoughts?

We have lots of things that are case-sensitive; I don't particularly
see why this one should be different.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: keywords in initdb are case-sensitive?

From
Alvaro Herrera
Date:
Excerpts from Robert Haas's message of jue feb 02 11:39:29 -0300 2012:
> On Wed, Feb 1, 2012 at 11:45 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> > In miracee's review of Peter's patch for new -A options in initdb (in
> > commitfest app only), it is noted that pg_hba.conf keyword parsing is
> > done in a case sensitive manner.  So if you write "Trust" rather than
> > "trust", it's not recognized.
> >
> > This seemed pretty nonsensical to me, and it's not documented, so I came
> > up with the trivial attached patch.
> >
> > Comparisons to user and database names and the like are unchanged and
> > thus require matching case.
>
> We have lots of things that are case-sensitive; I don't particularly
> see why this one should be different.

Err, postgresql.conf processing is case insensitive, which is the most
closely related example.  Are you saying we should make that case
sensitive as well?  What I'm saying is that I see no good reason for
keyword comparison to be case sensitive here.  We don't compare case on
SQL keywords either.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: keywords in pg_hba.conf are case-sensitive?

From
Tom Lane
Date:
[ adjusting thread title to have something to do with reality ]

Alvaro Herrera <alvherre@commandprompt.com> writes:
> Excerpts from Robert Haas's message of jue feb 02 11:39:29 -0300 2012:
>> We have lots of things that are case-sensitive; I don't particularly
>> see why this one should be different.

> Err, postgresql.conf processing is case insensitive, which is the most
> closely related example.  Are you saying we should make that case
> sensitive as well?  What I'm saying is that I see no good reason for
> keyword comparison to be case sensitive here.  We don't compare case on
> SQL keywords either.

One thing I'm concerned about is that there are places in pg_hba.conf
where a token might be either a keyword or a user/group/database name.
If you start recognizing keywords case-insensitively, you could break
files that used to work, ie what was meant to be a name will now be
read as a keyword.  Admittedly, the odds of that are not very large, but
they're not zero either.  Given the entire lack of complaints about this
from the field, I'm inclined to think it's better to leave well enough
alone.  We could add a documentation note if you feel a need for that.
        regards, tom lane


Re: keywords in pg_hba.conf are case-sensitive?

From
Magnus Hagander
Date:
<p><br /> On Feb 2, 2012 5:34 PM, "Tom Lane" <<a href="mailto:tgl@sss.pgh.pa.us">tgl@sss.pgh.pa.us</a>> wrote:<br
/>><br /> > [ adjusting thread title to have something to do with reality ]<br /> ><br /> > Alvaro Herrera
<<ahref="mailto:alvherre@commandprompt.com">alvherre@commandprompt.com</a>> writes:<br /> > > Excerpts from
RobertHaas's message of jue feb 02 11:39:29 -0300 2012:<br /> > >> We have lots of things that are
case-sensitive;I don't particularly<br /> > >> see why this one should be different.<br /> ><br /> >
>Err, postgresql.conf processing is case insensitive, which is the most<br /> > > closely related example.
 Areyou saying we should make that case<br /> > > sensitive as well?  What I'm saying is that I see no good
reasonfor<br /> > > keyword comparison to be case sensitive here.  We don't compare case on<br /> > > SQL
keywordseither.<br /> ><br /> > One thing I'm concerned about is that there are places in pg_hba.conf<br /> >
wherea token might be either a keyword or a user/group/database name.<br /> > If you start recognizing keywords
case-insensitively,you could break<br /> > files that used to work, ie what was meant to be a name will now be<br />
>read as a keyword.  Admittedly, the odds of that are not very large, but<br /> > they're not zero either.  Given
theentire lack of complaints about this<br /> > from the field, I'm inclined to think it's better to leave well
enough<br/> > alone.  We could add a documentation note if you feel a need for that.<br /><p>+1. I don't think I've
hearda single complaint about this ever... <p>/Magnus <br />