Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers.
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
This commit is contained in:
parent
9fd8b7d632
commit
fb8697b31a
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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),
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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 { \
|
||||
|
@ -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
|
||||
|
@ -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%'
|
||||
|
@ -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.
|
||||
--
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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 '
|
||||
|
@ -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"
|
||||
|
@ -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'
|
||||
);
|
||||
|
||||
|
@ -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%'
|
||||
|
@ -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.
|
||||
--
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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"
|
||||
);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user