Re: [HACKERS] Refactoring identifier checks to consistently use strcmp

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Refactoring identifier checks to consistently use strcmp
Дата
Msg-id 25815.1502898692@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Refactoring identifier checks to consistently use strcmp  (Heikki Linnakangas <hlinnaka@iki.fi>)
Ответы Re: [HACKERS] Refactoring identifier checks to consistently use strcmp  (Robert Haas <robertmhaas@gmail.com>)
Re: [HACKERS] Refactoring identifier checks to consistently use strcmp  (Daniel Gustafsson <daniel@yesql.se>)
Список pgsql-hackers
Heikki Linnakangas <hlinnaka@iki.fi> writes:
> This no longer works:

> postgres=# CREATE TEXT SEARCH DICTIONARY public.simple_dict (
>      TEMPLATE = pg_catalog.simple,
>      "STOPWORds" = english
> );
> ERROR:  unrecognized simple dictionary parameter: "STOPWORds"

> In hindsight, perhaps we should always have been more strict about that 
> to begin wtih, but let's not break backwards-compatibility without a 
> better reason. I didn't thoroughly check all of the cases here, to see 
> if there are more like this.

You have a point, but I'm not sure that this is such a bad compatibility
break as to be a reason not to change things to be more consistent.

> It'd be nice to have some kind of a rule on when pg_strcasecmp should be 
> used and when strcmp() is enough. Currently, by looking at the code, I 
> can't tell.

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.  If the user
prevented case-folding by double-quoting, I don't have a lot of sympathy
for any complaints about it.  Generally speaking, what we're dealing with
here is things that are logically keywords but we did not wish to make
them real parser keywords.  But in SQL, once you quote a keyword, it's
not a keyword at all anymore.  So I think the argument that quoting
"stopwords" should be legal at all in this context is pretty weak,
and the argument that quoting a weirdly-cased version of it should
work is even weaker.

pg_strcasecmp would be appropriate, perhaps, if we're dealing with stuff
that somehow came in without going through the parser.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Marina Polyakova
Дата:
Сообщение: Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] [COMMITTERS] pgsql: Simplify plpgsql's check for simple expressions.