]> granicus.if.org Git - postgresql/commitdiff
Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 26 Jan 2018 23:25:02 +0000 (18:25 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 26 Jan 2018 23:25:14 +0000 (18:25 -0500)
We have a lot of code in which option names, which from the user's
viewpoint are logically keywords, are passed through the grammar as plain
identifiers, and then matched to string literals during command execution.
This approach avoids making words into lexer keywords unnecessarily.  Some
places matched these strings using plain strcmp, some using pg_strcasecmp.
But the latter should be unnecessary since identifiers would have been
downcased on their way through the parser.  Aside from any efficiency
concerns (probably not a big factor), the lack of consistency in this area
creates a hazard of subtle bugs due to different places coming to different
conclusions about whether two option names are the same or different.
Hence, standardize on using strcmp() to match any option names that are
expected to have been fed through the parser.

This does create a user-visible behavioral change, which is that while
formerly all of these would work:
alter table foo set (fillfactor = 50);
alter table foo set (FillFactor = 50);
alter table foo set ("fillfactor" = 50);
alter table foo set ("FillFactor" = 50);
now the last case will fail because that double-quoted identifier is
different from the others.  However, none of our documentation says that
you can use a quoted identifier in such contexts at all, and we should
discourage doing so since it would break if we ever decide to parse such
constructs as true lexer keywords rather than poor man's substitutes.
So this shouldn't create a significant compatibility issue for users.

Daniel Gustafsson, reviewed by Michael Paquier, small changes by me

Discussion: https://postgr.es/m/29405B24-564E-476B-98C0-677A29805B84@yesql.se

37 files changed:
contrib/dict_int/dict_int.c
contrib/dict_xsyn/dict_xsyn.c
contrib/unaccent/unaccent.c
doc/src/sgml/textsearch.sgml
src/backend/access/common/reloptions.c
src/backend/commands/aggregatecmds.c
src/backend/commands/collationcmds.c
src/backend/commands/operatorcmds.c
src/backend/commands/tablecmds.c
src/backend/commands/tsearchcmds.c
src/backend/commands/typecmds.c
src/backend/commands/view.c
src/backend/parser/parse_clause.c
src/backend/snowball/dict_snowball.c
src/backend/tsearch/dict_ispell.c
src/backend/tsearch/dict_simple.c
src/backend/tsearch/dict_synonym.c
src/backend/tsearch/dict_thesaurus.c
src/include/access/reloptions.h
src/test/regress/expected/aggregates.out
src/test/regress/expected/alter_generic.out
src/test/regress/expected/alter_operator.out
src/test/regress/expected/collate.out
src/test/regress/expected/create_aggregate.out
src/test/regress/expected/create_operator.out
src/test/regress/expected/create_table.out
src/test/regress/expected/create_type.out
src/test/regress/expected/tsdicts.out
src/test/regress/sql/aggregates.sql
src/test/regress/sql/alter_generic.sql
src/test/regress/sql/alter_operator.sql
src/test/regress/sql/collate.sql
src/test/regress/sql/create_aggregate.sql
src/test/regress/sql/create_operator.sql
src/test/regress/sql/create_table.sql
src/test/regress/sql/create_type.sql
src/test/regress/sql/tsdicts.sql

index 8b455329386869dd1637aeae92df94619d6e3985..56ede37089eacc233fd087ed8ac31f26e523d89e 100644 (file)
@@ -42,11 +42,11 @@ dintdict_init(PG_FUNCTION_ARGS)
        {
                DefElem    *defel = (DefElem *) lfirst(l);
 
-               if (pg_strcasecmp(defel->defname, "MAXLEN") == 0)
+               if (strcmp(defel->defname, "maxlen") == 0)
                {
                        d->maxlen = atoi(defGetString(defel));
                }
-               else if (pg_strcasecmp(defel->defname, "REJECTLONG") == 0)
+               else if (strcmp(defel->defname, "rejectlong") == 0)
                {
                        d->rejectlong = defGetBoolean(defel);
                }
index 8a3abf7e3c7e275d83de6d926758f3ff23530ffa..a79ece240cee564591830cfa3847e51b64b2fd96 100644 (file)
@@ -157,23 +157,23 @@ dxsyn_init(PG_FUNCTION_ARGS)
        {
                DefElem    *defel = (DefElem *) lfirst(l);
 
-               if (pg_strcasecmp(defel->defname, "MATCHORIG") == 0)
+               if (strcmp(defel->defname, "matchorig") == 0)
                {
                        d->matchorig = defGetBoolean(defel);
                }
-               else if (pg_strcasecmp(defel->defname, "KEEPORIG") == 0)
+               else if (strcmp(defel->defname, "keeporig") == 0)
                {
                        d->keeporig = defGetBoolean(defel);
                }
-               else if (pg_strcasecmp(defel->defname, "MATCHSYNONYMS") == 0)
+               else if (strcmp(defel->defname, "matchsynonyms") == 0)
                {
                        d->matchsynonyms = defGetBoolean(defel);
                }
-               else if (pg_strcasecmp(defel->defname, "KEEPSYNONYMS") == 0)
+               else if (strcmp(defel->defname, "keepsynonyms") == 0)
                {
                        d->keepsynonyms = defGetBoolean(defel);
                }
-               else if (pg_strcasecmp(defel->defname, "RULES") == 0)
+               else if (strcmp(defel->defname, "rules") == 0)
                {
                        /* we can't read the rules before parsing all options! */
                        filename = defGetString(defel);
index 82f9c7fcfe1ad37c148485446b9728d1edb5015d..247c202755bbdb19a366d3b16fa8c6bd3e46213a 100644 (file)
@@ -276,7 +276,7 @@ unaccent_init(PG_FUNCTION_ARGS)
        {
                DefElem    *defel = (DefElem *) lfirst(l);
 
-               if (pg_strcasecmp("Rules", defel->defname) == 0)
+               if (strcmp(defel->defname, "rules") == 0)
                {
                        if (fileloaded)
                                ereport(ERROR,
index 1a2f04019c105cdd29910b092a8c95dd62f9be82..610b7bf03374f70a887ad552614f59c4d25d268e 100644 (file)
@@ -1271,6 +1271,7 @@ ts_headline(<optional> <replaceable class="parameter">config</replaceable> <type
      </listitem>
     </itemizedlist>
 
+    These option names are recognized case-insensitively.
     Any unspecified options receive these defaults:
 
 <programlisting>
index 274f7aa8e9762cd773577824b4adb411ef4c0748..46276ceff1cdbc373ca4df245451e15f3c64bd9a 100644 (file)
@@ -796,12 +796,12 @@ transformRelOptions(Datum oldOptions, List *defList, const char *namspace,
                                }
                                else if (def->defnamespace == NULL)
                                        continue;
-                               else if (pg_strcasecmp(def->defnamespace, namspace) != 0)
+                               else if (strcmp(def->defnamespace, namspace) != 0)
                                        continue;
 
                                kw_len = strlen(def->defname);
                                if (text_len > kw_len && text_str[kw_len] == '=' &&
-                                       pg_strncasecmp(text_str, def->defname, kw_len) == 0)
+                                       strncmp(text_str, def->defname, kw_len) == 0)
                                        break;
                        }
                        if (!cell)
@@ -849,8 +849,7 @@ transformRelOptions(Datum oldOptions, List *defList, const char *namspace,
                                {
                                        for (i = 0; validnsps[i]; i++)
                                        {
-                                               if (pg_strcasecmp(def->defnamespace,
-                                                                                 validnsps[i]) == 0)
+                                               if (strcmp(def->defnamespace, validnsps[i]) == 0)
                                                {
                                                        valid = true;
                                                        break;
@@ -865,7 +864,7 @@ transformRelOptions(Datum oldOptions, List *defList, const char *namspace,
                                                                        def->defnamespace)));
                        }
 
-                       if (ignoreOids && pg_strcasecmp(def->defname, "oids") == 0)
+                       if (ignoreOids && strcmp(def->defname, "oids") == 0)
                                continue;
 
                        /* ignore if not in the same namespace */
@@ -876,7 +875,7 @@ transformRelOptions(Datum oldOptions, List *defList, const char *namspace,
                        }
                        else if (def->defnamespace == NULL)
                                continue;
-                       else if (pg_strcasecmp(def->defnamespace, namspace) != 0)
+                       else if (strcmp(def->defnamespace, namspace) != 0)
                                continue;
 
                        /*
@@ -1082,8 +1081,7 @@ parseRelOptions(Datum options, bool validate, relopt_kind kind,
                                int                     kw_len = reloptions[j].gen->namelen;
 
                                if (text_len > kw_len && text_str[kw_len] == '=' &&
-                                       pg_strncasecmp(text_str, reloptions[j].gen->name,
-                                                                  kw_len) == 0)
+                                       strncmp(text_str, reloptions[j].gen->name, kw_len) == 0)
                                {
                                        parse_one_reloption(&reloptions[j], text_str, text_len,
                                                                                validate);
@@ -1262,7 +1260,7 @@ fillRelOptions(void *rdopts, Size basesize,
 
                for (j = 0; j < numelems; j++)
                {
-                       if (pg_strcasecmp(options[i].gen->name, elems[j].optname) == 0)
+                       if (strcmp(options[i].gen->name, elems[j].optname) == 0)
                        {
                                relopt_string *optstring;
                                char       *itempos = ((char *) rdopts) + elems[j].offset;
@@ -1556,9 +1554,9 @@ AlterTableGetRelOptionsLockLevel(List *defList)
 
                for (i = 0; relOpts[i]; i++)
                {
-                       if (pg_strncasecmp(relOpts[i]->name,
-                                                          def->defname,
-                                                          relOpts[i]->namelen + 1) == 0)
+                       if (strncmp(relOpts[i]->name,
+                                               def->defname,
+                                               relOpts[i]->namelen + 1) == 0)
                        {
                                if (lockmode < relOpts[i]->lockmode)
                                        lockmode = relOpts[i]->lockmode;
index 1779ba7bcb2cfd01907eff70e3e5db7560fdca4b..a48c3ac5727a50c28f3c9d434b561d80a70f47a8 100644 (file)
@@ -127,37 +127,37 @@ DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, List
                 * sfunc1, stype1, and initcond1 are accepted as obsolete spellings
                 * for sfunc, stype, initcond.
                 */
-               if (pg_strcasecmp(defel->defname, "sfunc") == 0)
+               if (strcmp(defel->defname, "sfunc") == 0)
                        transfuncName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "sfunc1") == 0)
+               else if (strcmp(defel->defname, "sfunc1") == 0)
                        transfuncName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "finalfunc") == 0)
+               else if (strcmp(defel->defname, "finalfunc") == 0)
                        finalfuncName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "combinefunc") == 0)
+               else if (strcmp(defel->defname, "combinefunc") == 0)
                        combinefuncName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "serialfunc") == 0)
+               else if (strcmp(defel->defname, "serialfunc") == 0)
                        serialfuncName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "deserialfunc") == 0)
+               else if (strcmp(defel->defname, "deserialfunc") == 0)
                        deserialfuncName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "msfunc") == 0)
+               else if (strcmp(defel->defname, "msfunc") == 0)
                        mtransfuncName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "minvfunc") == 0)
+               else if (strcmp(defel->defname, "minvfunc") == 0)
                        minvtransfuncName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "mfinalfunc") == 0)
+               else if (strcmp(defel->defname, "mfinalfunc") == 0)
                        mfinalfuncName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "finalfunc_extra") == 0)
+               else if (strcmp(defel->defname, "finalfunc_extra") == 0)
                        finalfuncExtraArgs = defGetBoolean(defel);
-               else if (pg_strcasecmp(defel->defname, "mfinalfunc_extra") == 0)
+               else if (strcmp(defel->defname, "mfinalfunc_extra") == 0)
                        mfinalfuncExtraArgs = defGetBoolean(defel);
-               else if (pg_strcasecmp(defel->defname, "finalfunc_modify") == 0)
+               else if (strcmp(defel->defname, "finalfunc_modify") == 0)
                        finalfuncModify = extractModify(defel);
-               else if (pg_strcasecmp(defel->defname, "mfinalfunc_modify") == 0)
+               else if (strcmp(defel->defname, "mfinalfunc_modify") == 0)
                        mfinalfuncModify = extractModify(defel);
-               else if (pg_strcasecmp(defel->defname, "sortop") == 0)
+               else if (strcmp(defel->defname, "sortop") == 0)
                        sortoperatorName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "basetype") == 0)
+               else if (strcmp(defel->defname, "basetype") == 0)
                        baseType = defGetTypeName(defel);
-               else if (pg_strcasecmp(defel->defname, "hypothetical") == 0)
+               else if (strcmp(defel->defname, "hypothetical") == 0)
                {
                        if (defGetBoolean(defel))
                        {
@@ -168,23 +168,23 @@ DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, List
                                aggKind = AGGKIND_HYPOTHETICAL;
                        }
                }
-               else if (pg_strcasecmp(defel->defname, "stype") == 0)
+               else if (strcmp(defel->defname, "stype") == 0)
                        transType = defGetTypeName(defel);
-               else if (pg_strcasecmp(defel->defname, "stype1") == 0)
+               else if (strcmp(defel->defname, "stype1") == 0)
                        transType = defGetTypeName(defel);
-               else if (pg_strcasecmp(defel->defname, "sspace") == 0)
+               else if (strcmp(defel->defname, "sspace") == 0)
                        transSpace = defGetInt32(defel);
-               else if (pg_strcasecmp(defel->defname, "mstype") == 0)
+               else if (strcmp(defel->defname, "mstype") == 0)
                        mtransType = defGetTypeName(defel);
-               else if (pg_strcasecmp(defel->defname, "msspace") == 0)
+               else if (strcmp(defel->defname, "msspace") == 0)
                        mtransSpace = defGetInt32(defel);
-               else if (pg_strcasecmp(defel->defname, "initcond") == 0)
+               else if (strcmp(defel->defname, "initcond") == 0)
                        initval = defGetString(defel);
-               else if (pg_strcasecmp(defel->defname, "initcond1") == 0)
+               else if (strcmp(defel->defname, "initcond1") == 0)
                        initval = defGetString(defel);
-               else if (pg_strcasecmp(defel->defname, "minitcond") == 0)
+               else if (strcmp(defel->defname, "minitcond") == 0)
                        minitval = defGetString(defel);
-               else if (pg_strcasecmp(defel->defname, "parallel") == 0)
+               else if (strcmp(defel->defname, "parallel") == 0)
                        parallel = defGetString(defel);
                else
                        ereport(WARNING,
@@ -420,11 +420,11 @@ DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, List
 
        if (parallel)
        {
-               if (pg_strcasecmp(parallel, "safe") == 0)
+               if (strcmp(parallel, "safe") == 0)
                        proparallel = PROPARALLEL_SAFE;
-               else if (pg_strcasecmp(parallel, "restricted") == 0)
+               else if (strcmp(parallel, "restricted") == 0)
                        proparallel = PROPARALLEL_RESTRICTED;
-               else if (pg_strcasecmp(parallel, "unsafe") == 0)
+               else if (strcmp(parallel, "unsafe") == 0)
                        proparallel = PROPARALLEL_UNSAFE;
                else
                        ereport(ERROR,
index fdfb3dcd2c89fd4c67b071b03353e018b2724b58..d0b5cdb69a2c613dc3a95fc66174cc0b5bd13fd9 100644 (file)
@@ -82,17 +82,17 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
                DefElem    *defel = lfirst_node(DefElem, pl);
                DefElem   **defelp;
 
-               if (pg_strcasecmp(defel->defname, "from") == 0)
+               if (strcmp(defel->defname, "from") == 0)
                        defelp = &fromEl;
-               else if (pg_strcasecmp(defel->defname, "locale") == 0)
+               else if (strcmp(defel->defname, "locale") == 0)
                        defelp = &localeEl;
-               else if (pg_strcasecmp(defel->defname, "lc_collate") == 0)
+               else if (strcmp(defel->defname, "lc_collate") == 0)
                        defelp = &lccollateEl;
-               else if (pg_strcasecmp(defel->defname, "lc_ctype") == 0)
+               else if (strcmp(defel->defname, "lc_ctype") == 0)
                        defelp = &lcctypeEl;
-               else if (pg_strcasecmp(defel->defname, "provider") == 0)
+               else if (strcmp(defel->defname, "provider") == 0)
                        defelp = &providerEl;
-               else if (pg_strcasecmp(defel->defname, "version") == 0)
+               else if (strcmp(defel->defname, "version") == 0)
                        defelp = &versionEl;
                else
                {
index 35404ac39a4ffcdb9c10d1054b9ef30ad33e3070..585382d7587906b83b7a85226635ae87702cbc84 100644 (file)
@@ -105,7 +105,7 @@ DefineOperator(List *names, List *parameters)
        {
                DefElem    *defel = (DefElem *) lfirst(pl);
 
-               if (pg_strcasecmp(defel->defname, "leftarg") == 0)
+               if (strcmp(defel->defname, "leftarg") == 0)
                {
                        typeName1 = defGetTypeName(defel);
                        if (typeName1->setof)
@@ -113,7 +113,7 @@ DefineOperator(List *names, List *parameters)
                                                (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
                                                 errmsg("SETOF type not allowed for operator argument")));
                }
-               else if (pg_strcasecmp(defel->defname, "rightarg") == 0)
+               else if (strcmp(defel->defname, "rightarg") == 0)
                {
                        typeName2 = defGetTypeName(defel);
                        if (typeName2->setof)
@@ -121,28 +121,28 @@ DefineOperator(List *names, List *parameters)
                                                (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
                                                 errmsg("SETOF type not allowed for operator argument")));
                }
-               else if (pg_strcasecmp(defel->defname, "procedure") == 0)
+               else if (strcmp(defel->defname, "procedure") == 0)
                        functionName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "commutator") == 0)
+               else if (strcmp(defel->defname, "commutator") == 0)
                        commutatorName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "negator") == 0)
+               else if (strcmp(defel->defname, "negator") == 0)
                        negatorName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "restrict") == 0)
+               else if (strcmp(defel->defname, "restrict") == 0)
                        restrictionName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "join") == 0)
+               else if (strcmp(defel->defname, "join") == 0)
                        joinName = defGetQualifiedName(defel);
-               else if (pg_strcasecmp(defel->defname, "hashes") == 0)
+               else if (strcmp(defel->defname, "hashes") == 0)
                        canHash = defGetBoolean(defel);
-               else if (pg_strcasecmp(defel->defname, "merges") == 0)
+               else if (strcmp(defel->defname, "merges") == 0)
                        canMerge = defGetBoolean(defel);
                /* These obsolete options are taken as meaning canMerge */
-               else if (pg_strcasecmp(defel->defname, "sort1") == 0)
+               else if (strcmp(defel->defname, "sort1") == 0)
                        canMerge = true;
-               else if (pg_strcasecmp(defel->defname, "sort2") == 0)
+               else if (strcmp(defel->defname, "sort2") == 0)
                        canMerge = true;
-               else if (pg_strcasecmp(defel->defname, "ltcmp") == 0)
+               else if (strcmp(defel->defname, "ltcmp") == 0)
                        canMerge = true;
-               else if (pg_strcasecmp(defel->defname, "gtcmp") == 0)
+               else if (strcmp(defel->defname, "gtcmp") == 0)
                        canMerge = true;
                else
                {
@@ -420,12 +420,12 @@ AlterOperator(AlterOperatorStmt *stmt)
                else
                        param = defGetQualifiedName(defel);
 
-               if (pg_strcasecmp(defel->defname, "restrict") == 0)
+               if (strcmp(defel->defname, "restrict") == 0)
                {
                        restrictionName = param;
                        updateRestriction = true;
                }
-               else if (pg_strcasecmp(defel->defname, "join") == 0)
+               else if (strcmp(defel->defname, "join") == 0)
                {
                        joinName = param;
                        updateJoin = true;
@@ -435,13 +435,13 @@ AlterOperator(AlterOperatorStmt *stmt)
                 * The rest of the options that CREATE accepts cannot be changed.
                 * Check for them so that we can give a meaningful error message.
                 */
-               else if (pg_strcasecmp(defel->defname, "leftarg") == 0 ||
-                                pg_strcasecmp(defel->defname, "rightarg") == 0 ||
-                                pg_strcasecmp(defel->defname, "procedure") == 0 ||
-                                pg_strcasecmp(defel->defname, "commutator") == 0 ||
-                                pg_strcasecmp(defel->defname, "negator") == 0 ||
-                                pg_strcasecmp(defel->defname, "hashes") == 0 ||
-                                pg_strcasecmp(defel->defname, "merges") == 0)
+               else if (strcmp(defel->defname, "leftarg") == 0 ||
+                                strcmp(defel->defname, "rightarg") == 0 ||
+                                strcmp(defel->defname, "procedure") == 0 ||
+                                strcmp(defel->defname, "commutator") == 0 ||
+                                strcmp(defel->defname, "negator") == 0 ||
+                                strcmp(defel->defname, "hashes") == 0 ||
+                                strcmp(defel->defname, "merges") == 0)
                {
                        ereport(ERROR,
                                        (errcode(ERRCODE_SYNTAX_ERROR),
index 2e768dd5e46ff1fdc6c130418572789d7af2c46f..ea03fd2ecf35c0ae931bc34e5640ccb5b60dd50f 100644 (file)
@@ -10536,7 +10536,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
                {
                        DefElem    *defel = (DefElem *) lfirst(cell);
 
-                       if (pg_strcasecmp(defel->defname, "check_option") == 0)
+                       if (strcmp(defel->defname, "check_option") == 0)
                                check_option = true;
                }
 
index bdf3857ce41514112302c826a57a8e90a034b6df..3a843512d132a5f593485b0b0dcfb2000433d1b6 100644 (file)
@@ -209,27 +209,27 @@ DefineTSParser(List *names, List *parameters)
        {
                DefElem    *defel = (DefElem *) lfirst(pl);
 
-               if (pg_strcasecmp(defel->defname, "start") == 0)
+               if (strcmp(defel->defname, "start") == 0)
                {
                        values[Anum_pg_ts_parser_prsstart - 1] =
                                get_ts_parser_func(defel, Anum_pg_ts_parser_prsstart);
                }
-               else if (pg_strcasecmp(defel->defname, "gettoken") == 0)
+               else if (strcmp(defel->defname, "gettoken") == 0)
                {
                        values[Anum_pg_ts_parser_prstoken - 1] =
                                get_ts_parser_func(defel, Anum_pg_ts_parser_prstoken);
                }
-               else if (pg_strcasecmp(defel->defname, "end") == 0)
+               else if (strcmp(defel->defname, "end") == 0)
                {
                        values[Anum_pg_ts_parser_prsend - 1] =
                                get_ts_parser_func(defel, Anum_pg_ts_parser_prsend);
                }
-               else if (pg_strcasecmp(defel->defname, "headline") == 0)
+               else if (strcmp(defel->defname, "headline") == 0)
                {
                        values[Anum_pg_ts_parser_prsheadline - 1] =
                                get_ts_parser_func(defel, Anum_pg_ts_parser_prsheadline);
                }
-               else if (pg_strcasecmp(defel->defname, "lextypes") == 0)
+               else if (strcmp(defel->defname, "lextypes") == 0)
                {
                        values[Anum_pg_ts_parser_prslextype - 1] =
                                get_ts_parser_func(defel, Anum_pg_ts_parser_prslextype);
@@ -438,7 +438,7 @@ DefineTSDictionary(List *names, List *parameters)
        {
                DefElem    *defel = (DefElem *) lfirst(pl);
 
-               if (pg_strcasecmp(defel->defname, "template") == 0)
+               if (strcmp(defel->defname, "template") == 0)
                {
                        templId = get_ts_template_oid(defGetQualifiedName(defel), false);
                }
@@ -580,7 +580,7 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt)
                        DefElem    *oldel = (DefElem *) lfirst(cell);
 
                        next = lnext(cell);
-                       if (pg_strcasecmp(oldel->defname, defel->defname) == 0)
+                       if (strcmp(oldel->defname, defel->defname) == 0)
                                dictoptions = list_delete_cell(dictoptions, cell, prev);
                        else
                                prev = cell;
@@ -765,13 +765,13 @@ DefineTSTemplate(List *names, List *parameters)
        {
                DefElem    *defel = (DefElem *) lfirst(pl);
 
-               if (pg_strcasecmp(defel->defname, "init") == 0)
+               if (strcmp(defel->defname, "init") == 0)
                {
                        values[Anum_pg_ts_template_tmplinit - 1] =
                                get_ts_template_func(defel, Anum_pg_ts_template_tmplinit);
                        nulls[Anum_pg_ts_template_tmplinit - 1] = false;
                }
-               else if (pg_strcasecmp(defel->defname, "lexize") == 0)
+               else if (strcmp(defel->defname, "lexize") == 0)
                {
                        values[Anum_pg_ts_template_tmpllexize - 1] =
                                get_ts_template_func(defel, Anum_pg_ts_template_tmpllexize);
@@ -990,9 +990,9 @@ DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
        {
                DefElem    *defel = (DefElem *) lfirst(pl);
 
-               if (pg_strcasecmp(defel->defname, "parser") == 0)
+               if (strcmp(defel->defname, "parser") == 0)
                        prsOid = get_ts_parser_oid(defGetQualifiedName(defel), false);
-               else if (pg_strcasecmp(defel->defname, "copy") == 0)
+               else if (strcmp(defel->defname, "copy") == 0)
                        sourceOid = get_ts_config_oid(defGetQualifiedName(defel), false);
                else
                        ereport(ERROR,
@@ -1251,7 +1251,6 @@ getTokenTypes(Oid prsId, List *tokennames)
                j = 0;
                while (list && list[j].lexid)
                {
-                       /* XXX should we use pg_strcasecmp here? */
                        if (strcmp(strVal(val), list[j].alias) == 0)
                        {
                                res[i] = list[j].lexid;
index 74eb430f96b04c512a9a1a23605c8075cd36b800..899a5c4cd4ccb063c00e1f0d1100a59cd96c0dd3 100644 (file)
@@ -245,42 +245,42 @@ DefineType(ParseState *pstate, List *names, List *parameters)
                DefElem    *defel = (DefElem *) lfirst(pl);
                DefElem   **defelp;
 
-               if (pg_strcasecmp(defel->defname, "like") == 0)
+               if (strcmp(defel->defname, "like") == 0)
                        defelp = &likeTypeEl;
-               else if (pg_strcasecmp(defel->defname, "internallength") == 0)
+               else if (strcmp(defel->defname, "internallength") == 0)
                        defelp = &internalLengthEl;
-               else if (pg_strcasecmp(defel->defname, "input") == 0)
+               else if (strcmp(defel->defname, "input") == 0)
                        defelp = &inputNameEl;
-               else if (pg_strcasecmp(defel->defname, "output") == 0)
+               else if (strcmp(defel->defname, "output") == 0)
                        defelp = &outputNameEl;
-               else if (pg_strcasecmp(defel->defname, "receive") == 0)
+               else if (strcmp(defel->defname, "receive") == 0)
                        defelp = &receiveNameEl;
-               else if (pg_strcasecmp(defel->defname, "send") == 0)
+               else if (strcmp(defel->defname, "send") == 0)
                        defelp = &sendNameEl;
-               else if (pg_strcasecmp(defel->defname, "typmod_in") == 0)
+               else if (strcmp(defel->defname, "typmod_in") == 0)
                        defelp = &typmodinNameEl;
-               else if (pg_strcasecmp(defel->defname, "typmod_out") == 0)
+               else if (strcmp(defel->defname, "typmod_out") == 0)
                        defelp = &typmodoutNameEl;
-               else if (pg_strcasecmp(defel->defname, "analyze") == 0 ||
-                                pg_strcasecmp(defel->defname, "analyse") == 0)
+               else if (strcmp(defel->defname, "analyze") == 0 ||
+                                strcmp(defel->defname, "analyse") == 0)
                        defelp = &analyzeNameEl;
-               else if (pg_strcasecmp(defel->defname, "category") == 0)
+               else if (strcmp(defel->defname, "category") == 0)
                        defelp = &categoryEl;
-               else if (pg_strcasecmp(defel->defname, "preferred") == 0)
+               else if (strcmp(defel->defname, "preferred") == 0)
                        defelp = &preferredEl;
-               else if (pg_strcasecmp(defel->defname, "delimiter") == 0)
+               else if (strcmp(defel->defname, "delimiter") == 0)
                        defelp = &delimiterEl;
-               else if (pg_strcasecmp(defel->defname, "element") == 0)
+               else if (strcmp(defel->defname, "element") == 0)
                        defelp = &elemTypeEl;
-               else if (pg_strcasecmp(defel->defname, "default") == 0)
+               else if (strcmp(defel->defname, "default") == 0)
                        defelp = &defaultValueEl;
-               else if (pg_strcasecmp(defel->defname, "passedbyvalue") == 0)
+               else if (strcmp(defel->defname, "passedbyvalue") == 0)
                        defelp = &byValueEl;
-               else if (pg_strcasecmp(defel->defname, "alignment") == 0)
+               else if (strcmp(defel->defname, "alignment") == 0)
                        defelp = &alignmentEl;
-               else if (pg_strcasecmp(defel->defname, "storage") == 0)
+               else if (strcmp(defel->defname, "storage") == 0)
                        defelp = &storageEl;
-               else if (pg_strcasecmp(defel->defname, "collatable") == 0)
+               else if (strcmp(defel->defname, "collatable") == 0)
                        defelp = &collatableEl;
                else
                {
@@ -1439,7 +1439,7 @@ DefineRange(CreateRangeStmt *stmt)
        {
                DefElem    *defel = (DefElem *) lfirst(lc);
 
-               if (pg_strcasecmp(defel->defname, "subtype") == 0)
+               if (strcmp(defel->defname, "subtype") == 0)
                {
                        if (OidIsValid(rangeSubtype))
                                ereport(ERROR,
@@ -1448,7 +1448,7 @@ DefineRange(CreateRangeStmt *stmt)
                        /* we can look up the subtype name immediately */
                        rangeSubtype = typenameTypeId(NULL, defGetTypeName(defel));
                }
-               else if (pg_strcasecmp(defel->defname, "subtype_opclass") == 0)
+               else if (strcmp(defel->defname, "subtype_opclass") == 0)
                {
                        if (rangeSubOpclassName != NIL)
                                ereport(ERROR,
@@ -1456,7 +1456,7 @@ DefineRange(CreateRangeStmt *stmt)
                                                 errmsg("conflicting or redundant options")));
                        rangeSubOpclassName = defGetQualifiedName(defel);
                }
-               else if (pg_strcasecmp(defel->defname, "collation") == 0)
+               else if (strcmp(defel->defname, "collation") == 0)
                {
                        if (rangeCollationName != NIL)
                                ereport(ERROR,
@@ -1464,7 +1464,7 @@ DefineRange(CreateRangeStmt *stmt)
                                                 errmsg("conflicting or redundant options")));
                        rangeCollationName = defGetQualifiedName(defel);
                }
-               else if (pg_strcasecmp(defel->defname, "canonical") == 0)
+               else if (strcmp(defel->defname, "canonical") == 0)
                {
                        if (rangeCanonicalName != NIL)
                                ereport(ERROR,
@@ -1472,7 +1472,7 @@ DefineRange(CreateRangeStmt *stmt)
                                                 errmsg("conflicting or redundant options")));
                        rangeCanonicalName = defGetQualifiedName(defel);
                }
-               else if (pg_strcasecmp(defel->defname, "subtype_diff") == 0)
+               else if (strcmp(defel->defname, "subtype_diff") == 0)
                {
                        if (rangeSubtypeDiffName != NIL)
                                ereport(ERROR,
index 04ad76a210a7367ac0eddb04cc7dba02ba2e386b..7d4511c585b8e3464c0c865316091371823a37f0 100644 (file)
@@ -46,8 +46,8 @@ void
 validateWithCheckOption(const char *value)
 {
        if (value == NULL ||
-               (pg_strcasecmp(value, "local") != 0 &&
-                pg_strcasecmp(value, "cascaded") != 0))
+               (strcmp(value, "local") != 0 &&
+                strcmp(value, "cascaded") != 0))
        {
                ereport(ERROR,
                                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@@ -485,7 +485,7 @@ DefineView(ViewStmt *stmt, const char *queryString,
        {
                DefElem    *defel = (DefElem *) lfirst(cell);
 
-               if (pg_strcasecmp(defel->defname, "check_option") == 0)
+               if (strcmp(defel->defname, "check_option") == 0)
                        check_option = true;
        }
 
index 9fbcfd4fa61006cbe53a70e944e5ede8a49f8eb9..406cd1dad03ab338b186ed549a22b80bac946272 100644 (file)
@@ -262,7 +262,7 @@ interpretOidsOption(List *defList, bool allowOids)
                DefElem    *def = (DefElem *) lfirst(cell);
 
                if (def->defnamespace == NULL &&
-                       pg_strcasecmp(def->defname, "oids") == 0)
+                       strcmp(def->defname, "oids") == 0)
                {
                        if (!allowOids)
                                ereport(ERROR,
index 043681ec2d80b95b57bf39b4062523297ddc26f2..78c9f73ef0339f0bbf42ceec5b550e1fa3d98048 100644 (file)
@@ -192,7 +192,7 @@ dsnowball_init(PG_FUNCTION_ARGS)
        {
                DefElem    *defel = (DefElem *) lfirst(l);
 
-               if (pg_strcasecmp("StopWords", defel->defname) == 0)
+               if (strcmp(defel->defname, "stopwords") == 0)
                {
                        if (stoploaded)
                                ereport(ERROR,
@@ -201,7 +201,7 @@ dsnowball_init(PG_FUNCTION_ARGS)
                        readstoplist(defGetString(defel), &d->stoplist, lowerstr);
                        stoploaded = true;
                }
-               else if (pg_strcasecmp("Language", defel->defname) == 0)
+               else if (strcmp(defel->defname, "language") == 0)
                {
                        if (d->stem)
                                ereport(ERROR,
index 0d706795ad9c1ae618a6e1b445778df39c19ffdc..edc654770078224e3ce808180e341c8608ab47b7 100644 (file)
@@ -44,7 +44,7 @@ dispell_init(PG_FUNCTION_ARGS)
        {
                DefElem    *defel = (DefElem *) lfirst(l);
 
-               if (pg_strcasecmp(defel->defname, "DictFile") == 0)
+               if (strcmp(defel->defname, "dictfile") == 0)
                {
                        if (dictloaded)
                                ereport(ERROR,
@@ -55,7 +55,7 @@ dispell_init(PG_FUNCTION_ARGS)
                                                                                                                   "dict"));
                        dictloaded = true;
                }
-               else if (pg_strcasecmp(defel->defname, "AffFile") == 0)
+               else if (strcmp(defel->defname, "afffile") == 0)
                {
                        if (affloaded)
                                ereport(ERROR,
@@ -66,7 +66,7 @@ dispell_init(PG_FUNCTION_ARGS)
                                                                                                                "affix"));
                        affloaded = true;
                }
-               else if (pg_strcasecmp(defel->defname, "StopWords") == 0)
+               else if (strcmp(defel->defname, "stopwords") == 0)
                {
                        if (stoploaded)
                                ereport(ERROR,
index 268b4e48cf7569d9485c97ea71a8f2a058538eca..ac6a24eba5b739004c1707a28d12af470568b1bc 100644 (file)
@@ -41,7 +41,7 @@ dsimple_init(PG_FUNCTION_ARGS)
        {
                DefElem    *defel = (DefElem *) lfirst(l);
 
-               if (pg_strcasecmp("StopWords", defel->defname) == 0)
+               if (strcmp(defel->defname, "stopwords") == 0)
                {
                        if (stoploaded)
                                ereport(ERROR,
@@ -50,7 +50,7 @@ dsimple_init(PG_FUNCTION_ARGS)
                        readstoplist(defGetString(defel), &d->stoplist, lowerstr);
                        stoploaded = true;
                }
-               else if (pg_strcasecmp("Accept", defel->defname) == 0)
+               else if (strcmp(defel->defname, "accept") == 0)
                {
                        if (acceptloaded)
                                ereport(ERROR,
index 8ca65f3deda3644ac5d71e8e9865331bbb3c21ef..c011886cb05dee0f169123dd825e5625c0140371 100644 (file)
@@ -108,9 +108,9 @@ dsynonym_init(PG_FUNCTION_ARGS)
        {
                DefElem    *defel = (DefElem *) lfirst(l);
 
-               if (pg_strcasecmp("Synonyms", defel->defname) == 0)
+               if (strcmp(defel->defname, "synonyms") == 0)
                        filename = defGetString(defel);
-               else if (pg_strcasecmp("CaseSensitive", defel->defname) == 0)
+               else if (strcmp(defel->defname, "casesensitive") == 0)
                        case_sensitive = defGetBoolean(defel);
                else
                        ereport(ERROR,
index 23aaac8d074d52d8dacb7ed6fb9a0bb6b0d28910..24364e646d3c272197735705cb9ebfd317d0fe8e 100644 (file)
@@ -616,7 +616,7 @@ thesaurus_init(PG_FUNCTION_ARGS)
        {
                DefElem    *defel = (DefElem *) lfirst(l);
 
-               if (pg_strcasecmp("DictFile", defel->defname) == 0)
+               if (strcmp(defel->defname, "dictfile") == 0)
                {
                        if (fileloaded)
                                ereport(ERROR,
@@ -625,7 +625,7 @@ thesaurus_init(PG_FUNCTION_ARGS)
                        thesaurusRead(defGetString(defel), d);
                        fileloaded = true;
                }
-               else if (pg_strcasecmp("Dictionary", defel->defname) == 0)
+               else if (strcmp(defel->defname, "dictionary") == 0)
                {
                        if (subdictname)
                                ereport(ERROR,
index 94739f7ac6d4fd04a1c80e8b17282b6b4a15300b..b32c1e9efe57e41bc9e3b08d28ca3602021aba07 100644 (file)
@@ -166,7 +166,7 @@ typedef struct
  *     code block.
  */
 #define HAVE_RELOPTION(optname, option) \
-       (pg_strncasecmp(option.gen->name, optname, option.gen->namelen + 1) == 0)
+       (strncmp(option.gen->name, optname, option.gen->namelen + 1) == 0)
 
 #define HANDLE_INT_RELOPTION(optname, var, option, wasset)             \
        do {                                                                                                            \
index dbce7d3e8b7903d8775ae6a62930dfdc1309e68e..f85e9138504a83cc8eb124147525575e0085ea80 100644 (file)
@@ -2007,12 +2007,13 @@ BEGIN
     END IF;
     RETURN NULL;
 END$$;
-CREATE AGGREGATE balk(
-    BASETYPE = int4,
+CREATE AGGREGATE balk(int4)
+(
     SFUNC = balkifnull(int8, int4),
     STYPE = int8,
-    "PARALLEL" = SAFE,
-    INITCOND = '0');
+    PARALLEL = SAFE,
+    INITCOND = '0'
+);
 SELECT balk(hundred) FROM tenk1;
  balk 
 ------
@@ -2035,12 +2036,12 @@ BEGIN
     END IF;
     RETURN NULL;
 END$$;
-CREATE AGGREGATE balk(
-    BASETYPE = int4,
+CREATE AGGREGATE balk(int4)
+(
     SFUNC = int4_sum(int8, int4),
     STYPE = int8,
     COMBINEFUNC = balkifnull(int8, int8),
-    "PARALLEL" = SAFE,
+    PARALLEL = SAFE,
     INITCOND = '0'
 );
 -- force use of parallelism
index 767c09bec5e114933a6ce9e5e37ae212891dcb2a..200828aa995e86597ab1af07cfb1661951d63117 100644 (file)
@@ -633,6 +633,9 @@ ALTER TEXT SEARCH TEMPLATE alt_ts_temp2 SET SCHEMA alt_nsp2;    -- OK
 CREATE TEXT SEARCH TEMPLATE alt_ts_temp2 (lexize=dsimple_lexize);
 ALTER TEXT SEARCH TEMPLATE alt_ts_temp2 SET SCHEMA alt_nsp2;    -- failed (name conflict)
 ERROR:  text search template "alt_ts_temp2" already exists in schema "alt_nsp2"
+-- invalid: non-lowercase quoted identifiers
+CREATE TEXT SEARCH TEMPLATE tstemp_case ("Init" = init_function);
+ERROR:  text search template parameter "Init" not recognized
 SELECT nspname, tmplname
   FROM pg_ts_template t, pg_namespace n
   WHERE t.tmplnamespace = n.oid AND nspname like 'alt_nsp%'
@@ -659,6 +662,9 @@ CREATE TEXT SEARCH PARSER alt_ts_prs2
     (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);
 ALTER TEXT SEARCH PARSER alt_ts_prs2 SET SCHEMA alt_nsp2;   -- failed (name conflict)
 ERROR:  text search parser "alt_ts_prs2" already exists in schema "alt_nsp2"
+-- invalid: non-lowercase quoted identifiers
+CREATE TEXT SEARCH PARSER tspars_case ("Start" = start_function);
+ERROR:  text search parser parameter "Start" not recognized
 SELECT nspname, prsname
   FROM pg_ts_parser t, pg_namespace n
   WHERE t.prsnamespace = n.oid AND nspname like 'alt_nsp%'
index ef47affd7b68ad9115f61817d991acd3436c0174..71bd4842821fc59c8481ba5019a681bfc4943ec9 100644 (file)
@@ -121,6 +121,9 @@ ALTER OPERATOR === (boolean, boolean) SET (COMMUTATOR = !==);
 ERROR:  operator attribute "commutator" cannot be changed
 ALTER OPERATOR === (boolean, boolean) SET (NEGATOR = !==);
 ERROR:  operator attribute "negator" cannot be changed
+-- invalid: non-lowercase quoted identifiers
+ALTER OPERATOR & (bit, bit) SET ("Restrict" = _int_contsel, "Join" = _int_contjoinsel);
+ERROR:  operator attribute "Restrict" not recognized
 --
 -- Test permission check. Must be owner to ALTER OPERATOR.
 --
index b0025c0a87e80b07a35bf1fa64de29e619d9937e..3bc3713ee1b44b2c4f2dd64e9222309976b68911 100644 (file)
@@ -633,6 +633,11 @@ DROP COLLATION mycoll2;  -- fail
 ERROR:  cannot drop collation mycoll2 because other objects depend on it
 DETAIL:  table collate_test23 column f1 depends on collation mycoll2
 HINT:  Use DROP ... CASCADE to drop the dependent objects too.
+-- invalid: non-lowercase quoted identifiers
+CREATE COLLATION case_coll ("Lc_Collate" = "POSIX", "Lc_Ctype" = "POSIX");
+ERROR:  collation attribute "Lc_Collate" not recognized
+LINE 1: CREATE COLLATION case_coll ("Lc_Collate" = "POSIX", "Lc_Ctyp...
+                                    ^
 -- 9.1 bug with useless COLLATE in an expression subject to length coercion
 CREATE TEMP TABLE vctable (f1 varchar(25));
 INSERT INTO vctable VALUES ('foo' COLLATE "C");
index ef65cd54ca234f025eba46df299c8afc497f9ce8..b9b7fbcc9e47f96a232623fc22d50059827e1cf4 100644 (file)
@@ -195,3 +195,33 @@ CREATE AGGREGATE wrongreturntype (float8)
     minvfunc = float8mi_int
 );
 ERROR:  return type of inverse transition function float8mi_int is not double precision
+-- invalid: non-lowercase quoted identifiers
+CREATE AGGREGATE case_agg ( -- old syntax
+       "Sfunc1" = int4pl,
+       "Basetype" = int4,
+       "Stype1" = int4,
+       "Initcond1" = '0',
+       "Parallel" = safe
+);
+WARNING:  aggregate attribute "Sfunc1" not recognized
+WARNING:  aggregate attribute "Basetype" not recognized
+WARNING:  aggregate attribute "Stype1" not recognized
+WARNING:  aggregate attribute "Initcond1" not recognized
+WARNING:  aggregate attribute "Parallel" not recognized
+ERROR:  aggregate stype must be specified
+CREATE AGGREGATE case_agg(float8)
+(
+       "Stype" = internal,
+       "Sfunc" = ordered_set_transition,
+       "Finalfunc" = percentile_disc_final,
+       "Finalfunc_extra" = true,
+       "Finalfunc_modify" = read_write,
+       "Parallel" = safe
+);
+WARNING:  aggregate attribute "Stype" not recognized
+WARNING:  aggregate attribute "Sfunc" not recognized
+WARNING:  aggregate attribute "Finalfunc" not recognized
+WARNING:  aggregate attribute "Finalfunc_extra" not recognized
+WARNING:  aggregate attribute "Finalfunc_modify" not recognized
+WARNING:  aggregate attribute "Parallel" not recognized
+ERROR:  aggregate stype must be specified
index 3a216c2ca8fd1eb58e3385ba4d019596eb29c70f..3c4ccae1e7aff17e782014b8cb66da9e52275359 100644 (file)
@@ -172,3 +172,26 @@ CREATE OPERATOR #*# (
 );
 ERROR:  permission denied for type type_op6
 ROLLBACK;
+-- invalid: non-lowercase quoted identifiers
+CREATE OPERATOR ===
+(
+       "Leftarg" = box,
+       "Rightarg" = box,
+       "Procedure" = area_equal_procedure,
+       "Commutator" = ===,
+       "Negator" = !==,
+       "Restrict" = area_restriction_procedure,
+       "Join" = area_join_procedure,
+       "Hashes",
+       "Merges"
+);
+WARNING:  operator attribute "Leftarg" not recognized
+WARNING:  operator attribute "Rightarg" not recognized
+WARNING:  operator attribute "Procedure" not recognized
+WARNING:  operator attribute "Commutator" not recognized
+WARNING:  operator attribute "Negator" not recognized
+WARNING:  operator attribute "Restrict" not recognized
+WARNING:  operator attribute "Join" not recognized
+WARNING:  operator attribute "Hashes" not recognized
+WARNING:  operator attribute "Merges" not recognized
+ERROR:  operator procedure must be specified
index 8e745402ae4dbef82b14798eb06ca147b3746a51..ef0906776e83681afe5c5be4512c74446765ce87 100644 (file)
@@ -215,6 +215,11 @@ CREATE TABLE IF NOT EXISTS test_tsvector(
        t text
 );
 NOTICE:  relation "test_tsvector" already exists, skipping
+-- invalid: non-lowercase quoted reloptions identifiers
+CREATE TABLE tas_case WITH ("Fillfactor" = 10) AS SELECT 1 a;
+ERROR:  unrecognized parameter "Fillfactor"
+CREATE TABLE tas_case (a text) WITH ("Oids" = true);
+ERROR:  unrecognized parameter "Oids"
 CREATE UNLOGGED TABLE unlogged1 (a int primary key);                   -- OK
 CREATE TEMPORARY TABLE unlogged2 (a int primary key);                  -- OK
 SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged\d' ORDER BY relname;
index 5886a1f37f3d947289140b2c28bb9520c6e996e3..4eef32bf4d100f97b63d913b4a89ca6d1924c014 100644 (file)
@@ -83,6 +83,34 @@ SELECT * FROM default_test;
  zippo | 42
 (1 row)
 
+-- invalid: non-lowercase quoted identifiers
+CREATE TYPE case_int42 (
+       "Internallength" = 4,
+       "Input" = int42_in,
+       "Output" = int42_out,
+       "Alignment" = int4,
+       "Default" = 42,
+       "Passedbyvalue"
+);
+WARNING:  type attribute "Internallength" not recognized
+LINE 2:  "Internallength" = 4,
+         ^
+WARNING:  type attribute "Input" not recognized
+LINE 3:  "Input" = int42_in,
+         ^
+WARNING:  type attribute "Output" not recognized
+LINE 4:  "Output" = int42_out,
+         ^
+WARNING:  type attribute "Alignment" not recognized
+LINE 5:  "Alignment" = int4,
+         ^
+WARNING:  type attribute "Default" not recognized
+LINE 6:  "Default" = 42,
+         ^
+WARNING:  type attribute "Passedbyvalue" not recognized
+LINE 7:  "Passedbyvalue"
+         ^
+ERROR:  type input function must be specified
 -- Test stand-alone composite type
 CREATE TYPE default_test_row AS (f1 text_w_default, f2 int42);
 CREATE FUNCTION get_default_test() RETURNS SETOF default_test_row AS '
index 0744ef803b1c95157f3d1424c267acaaec05474d..0c1d7c7675268a3aaf85ace6447379c821f311b6 100644 (file)
@@ -580,3 +580,11 @@ SELECT to_tsvector('thesaurus_tst', 'Booking tickets is looking like a booking a
  'card':3,10 'invit':2,9 'like':6 'look':5 'order':1,8
 (1 row)
 
+-- invalid: non-lowercase quoted identifiers
+CREATE TEXT SEARCH DICTIONARY tsdict_case
+(
+       Template = ispell,
+       "DictFile" = ispell_sample,
+       "AffFile" = ispell_sample
+);
+ERROR:  unrecognized Ispell parameter: "DictFile"
index 6c9b86a616609afbe6266e03dead56d2ee175a99..506d0442d7941b386bea0c070a49ba98177b63d9 100644 (file)
@@ -861,12 +861,13 @@ BEGIN
     RETURN NULL;
 END$$;
 
-CREATE AGGREGATE balk(
-    BASETYPE = int4,
+CREATE AGGREGATE balk(int4)
+(
     SFUNC = balkifnull(int8, int4),
     STYPE = int8,
-    "PARALLEL" = SAFE,
-    INITCOND = '0');
+    PARALLEL = SAFE,
+    INITCOND = '0'
+);
 
 SELECT balk(hundred) FROM tenk1;
 
@@ -888,12 +889,12 @@ BEGIN
     RETURN NULL;
 END$$;
 
-CREATE AGGREGATE balk(
-    BASETYPE = int4,
+CREATE AGGREGATE balk(int4)
+(
     SFUNC = int4_sum(int8, int4),
     STYPE = int8,
     COMBINEFUNC = balkifnull(int8, int8),
-    "PARALLEL" = SAFE,
+    PARALLEL = SAFE,
     INITCOND = '0'
 );
 
index 311812e351d5e8e8713d6a319b61c3e902fb05b7..96be6e752ad978ad09a196a35d7903a25c7d46cb 100644 (file)
@@ -543,6 +543,9 @@ ALTER TEXT SEARCH TEMPLATE alt_ts_temp2 SET SCHEMA alt_nsp2;    -- OK
 CREATE TEXT SEARCH TEMPLATE alt_ts_temp2 (lexize=dsimple_lexize);
 ALTER TEXT SEARCH TEMPLATE alt_ts_temp2 SET SCHEMA alt_nsp2;    -- failed (name conflict)
 
+-- invalid: non-lowercase quoted identifiers
+CREATE TEXT SEARCH TEMPLATE tstemp_case ("Init" = init_function);
+
 SELECT nspname, tmplname
   FROM pg_ts_template t, pg_namespace n
   WHERE t.tmplnamespace = n.oid AND nspname like 'alt_nsp%'
@@ -565,6 +568,9 @@ CREATE TEXT SEARCH PARSER alt_ts_prs2
     (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);
 ALTER TEXT SEARCH PARSER alt_ts_prs2 SET SCHEMA alt_nsp2;   -- failed (name conflict)
 
+-- invalid: non-lowercase quoted identifiers
+CREATE TEXT SEARCH PARSER tspars_case ("Start" = start_function);
+
 SELECT nspname, prsname
   FROM pg_ts_parser t, pg_namespace n
   WHERE t.prsnamespace = n.oid AND nspname like 'alt_nsp%'
index 51ffd7e0e0dee6ab9195ef40c55124322e5a8e6a..fd4037016572ef92f41dbe9a9319eeab4704f6b3 100644 (file)
@@ -81,6 +81,9 @@ ALTER OPERATOR === (boolean, boolean) SET (JOIN = non_existent_func);
 ALTER OPERATOR === (boolean, boolean) SET (COMMUTATOR = !==);
 ALTER OPERATOR === (boolean, boolean) SET (NEGATOR = !==);
 
+-- invalid: non-lowercase quoted identifiers
+ALTER OPERATOR & (bit, bit) SET ("Restrict" = _int_contsel, "Join" = _int_contjoinsel);
+
 --
 -- Test permission check. Must be owner to ALTER OPERATOR.
 --
index 698f57749068ba8b05f5c0647010ab46a4d4b86c..4ddde95a5e8efed5ea9a07ba9c18a1610ec9eb13 100644 (file)
@@ -239,6 +239,8 @@ DROP COLLATION mycoll1;
 CREATE TABLE collate_test23 (f1 text collate mycoll2);
 DROP COLLATION mycoll2;  -- fail
 
+-- invalid: non-lowercase quoted identifiers
+CREATE COLLATION case_coll ("Lc_Collate" = "POSIX", "Lc_Ctype" = "POSIX");
 
 -- 9.1 bug with useless COLLATE in an expression subject to length coercion
 
index 46e773bfe33a520ec55f06128fe4b546a1a0af93..590ca9a6247883c7a647fd7cad91c1f30ebd95cd 100644 (file)
@@ -211,3 +211,23 @@ CREATE AGGREGATE wrongreturntype (float8)
     msfunc = float8pl,
     minvfunc = float8mi_int
 );
+
+-- invalid: non-lowercase quoted identifiers
+
+CREATE AGGREGATE case_agg ( -- old syntax
+       "Sfunc1" = int4pl,
+       "Basetype" = int4,
+       "Stype1" = int4,
+       "Initcond1" = '0',
+       "Parallel" = safe
+);
+
+CREATE AGGREGATE case_agg(float8)
+(
+       "Stype" = internal,
+       "Sfunc" = ordered_set_transition,
+       "Finalfunc" = percentile_disc_final,
+       "Finalfunc_extra" = true,
+       "Finalfunc_modify" = read_write,
+       "Parallel" = safe
+);
index 0e5d6356bc39e0c91e9907921f29fc9349e11b7c..bb9907b3ed9c4ba914214fd1baf19aa2152a4710 100644 (file)
@@ -179,3 +179,17 @@ CREATE OPERATOR #*# (
    procedure = fn_op6
 );
 ROLLBACK;
+
+-- invalid: non-lowercase quoted identifiers
+CREATE OPERATOR ===
+(
+       "Leftarg" = box,
+       "Rightarg" = box,
+       "Procedure" = area_equal_procedure,
+       "Commutator" = ===,
+       "Negator" = !==,
+       "Restrict" = area_restriction_procedure,
+       "Join" = area_join_procedure,
+       "Hashes",
+       "Merges"
+);
index 8f9991ef18673701bcdc7c5935d5e87985e2731a..10e5d49e8e5f5773df5ab8c00e1bd84bf2f0dc78 100644 (file)
@@ -253,6 +253,10 @@ CREATE TABLE IF NOT EXISTS test_tsvector(
        t text
 );
 
+-- invalid: non-lowercase quoted reloptions identifiers
+CREATE TABLE tas_case WITH ("Fillfactor" = 10) AS SELECT 1 a;
+CREATE TABLE tas_case (a text) WITH ("Oids" = true);
+
 CREATE UNLOGGED TABLE unlogged1 (a int primary key);                   -- OK
 CREATE TEMPORARY TABLE unlogged2 (a int primary key);                  -- OK
 SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged\d' ORDER BY relname;
index a28303aa6a98c11066f894dc803d8dcb567d7b7f..2123d63e2efd8d64c27862f83c154eb8e631c2ec 100644 (file)
@@ -84,6 +84,16 @@ INSERT INTO default_test DEFAULT VALUES;
 
 SELECT * FROM default_test;
 
+-- invalid: non-lowercase quoted identifiers
+CREATE TYPE case_int42 (
+       "Internallength" = 4,
+       "Input" = int42_in,
+       "Output" = int42_out,
+       "Alignment" = int4,
+       "Default" = 42,
+       "Passedbyvalue"
+);
+
 -- Test stand-alone composite type
 
 CREATE TYPE default_test_row AS (f1 text_w_default, f2 int42);
index a5a569e1ad4f21e5b13ae33662fd1884163561aa..1633c0d066b60ad0020646b14c87d49c0b786f19 100644 (file)
@@ -188,3 +188,11 @@ ALTER TEXT SEARCH CONFIGURATION thesaurus_tst ALTER MAPPING FOR
 SELECT to_tsvector('thesaurus_tst', 'one postgres one two one two three one');
 SELECT to_tsvector('thesaurus_tst', 'Supernovae star is very new star and usually called supernovae (abbreviation SN)');
 SELECT to_tsvector('thesaurus_tst', 'Booking tickets is looking like a booking a tickets');
+
+-- invalid: non-lowercase quoted identifiers
+CREATE TEXT SEARCH DICTIONARY tsdict_case
+(
+       Template = ispell,
+       "DictFile" = ispell_sample,
+       "AffFile" = ispell_sample
+);