Re: [HACKERS] Refactoring identifier checks to consistently use strcmp - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [HACKERS] Refactoring identifier checks to consistently use strcmp
Date
Msg-id CAB7nPqQ3BqTCRw3cDat9QYLAPc=LSJs8f0j=eJ5k8zGWuBncjg@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Refactoring identifier checks to consistently use strcmp  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: [HACKERS] Refactoring identifier checks to consistently use strcmp  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
On Tue, Sep 5, 2017 at 5:34 PM, Daniel Gustafsson <daniel@yesql.se> wrote:
>> On 17 Aug 2017, at 11:08, Daniel Gustafsson <daniel@yesql.se> wrote:
>>> On 16 Aug 2017, at 17:51, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> My thought is that if we are looking at words that have been through the
>>> parser, then it should *always* be plain strcmp; we should expect that
>>> the parser already did the appropriate case-folding.
>>
>> +1
>>
>>> pg_strcasecmp would be appropriate, perhaps, if we're dealing with stuff
>>> that somehow came in without going through the parser.
>>
>> In that case it would be up to the consumer of the data to handle required
>> case-folding for the expected input, so pg_strcasecmp or strcmp depending on
>> situation.
>
> This patch has been marked “Waiting on Author”, but I’m not sure what the
> concensus of this thread came to with regards to quoted keywords and backwards
> compatibility.  There seems to be a 2-1 vote for allowing a break, and forcing
> all keywords out of the parser to be casefolded. Any other opinions?

This patch impacts the DDL grammar of aggregates, operators,
collations, text search, views, etc. Still I agree with the purpose of
this thread that it would be nice to get a more consistent behavior
even if it breaks some queries, so +1 for the argument with the
post-parser comparison which should use strcmp.

The patch needs a rebase, and there are a couple of places that need
an extra lookup I think:
$ git grep defname -- *.c | grep strcasecmp | wc -l     39

Switching to "waiting on author" for now.
Thanks,
--
Michael


pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [HACKERS] Assertion failure when the non-exclusive pg_stop_backup aborted.
Next
From: Glen Knowles
Date:
Subject: Re: _WINSOCK_DEPRECATED_NO_WARNINGS