Re: keywords in initdb are case-sensitive?

Lists: pgsql-hackers
From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: keywords in initdb are case-sensitive?
Date: 2012-02-02 04:45:15
Message-ID: 1328157307-sup-2460@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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(at)alvh(dot)no-ip(dot)org>

Attachment Content-Type Size
hba-casecmp.patch application/octet-stream 8.8 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: keywords in initdb are case-sensitive?
Date: 2012-02-02 14:39:29
Message-ID: CA+TgmoZ3v2bag2kFacKLHipq-9xsCgbqb5cz0_Xu+FCWPyNWNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Feb 1, 2012 at 11:45 PM, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)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


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: keywords in initdb are case-sensitive?
Date: 2012-02-02 15:10:12
Message-ID: 1328195319-sup-3736@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


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(at)alvh(dot)no-ip(dot)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(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: keywords in pg_hba.conf are case-sensitive?
Date: 2012-02-02 16:33:30
Message-ID: 25350.1328200410@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

[ adjusting thread title to have something to do with reality ]

Alvaro Herrera <alvherre(at)commandprompt(dot)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


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: keywords in pg_hba.conf are case-sensitive?
Date: 2012-02-02 19:14:12
Message-ID: CABUevEyDrK9aMgFTEos6UicMk4aV_dkqa_+3_3uEUepRbW=BPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Feb 2, 2012 5:34 PM, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> [ adjusting thread title to have something to do with reality ]
>
> Alvaro Herrera <alvherre(at)commandprompt(dot)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.

+1. I don't think I've heard a single complaint about this ever...

/Magnus