aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/access/transam/xlog.c10
-rw-r--r--src/backend/commands/aggregatecmds.c20
-rw-r--r--src/backend/commands/define.c6
-rw-r--r--src/backend/commands/functioncmds.c6
-rw-r--r--src/backend/commands/operatorcmds.c28
-rw-r--r--src/backend/commands/tablecmds.c10
-rw-r--r--src/backend/commands/typecmds.c56
-rw-r--r--src/backend/commands/variable.c36
-rw-r--r--src/backend/regex/regc_locale.c50
-rw-r--r--src/backend/regex/regcomp.c24
-rw-r--r--src/backend/utils/adt/acl.c82
-rw-r--r--src/backend/utils/adt/bool.c14
-rw-r--r--src/backend/utils/adt/cash.c4
-rw-r--r--src/backend/utils/adt/date.c63
-rw-r--r--src/backend/utils/adt/datetime.c12
-rw-r--r--src/backend/utils/adt/encode.c4
-rw-r--r--src/backend/utils/adt/float.c14
-rw-r--r--src/backend/utils/adt/formatting.c22
-rw-r--r--src/backend/utils/adt/numeric.c4
-rw-r--r--src/backend/utils/adt/regexp.c8
-rw-r--r--src/backend/utils/adt/regproc.c4
-rw-r--r--src/backend/utils/adt/tid.c4
-rw-r--r--src/backend/utils/adt/timestamp.c193
-rw-r--r--src/backend/utils/error/elog.c18
-rw-r--r--src/backend/utils/misc/guc.c94
25 files changed, 330 insertions, 456 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 6a1ccef8ec5..b6199706f67 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.139 2004/04/19 17:42:57 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.140 2004/05/07 00:24:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3778,27 +3778,27 @@ assign_xlog_sync_method(const char *method, bool doit, GucSource source)
int new_sync_method;
int new_sync_bit;
- if (strcasecmp(method, "fsync") == 0)
+ if (pg_strcasecmp(method, "fsync") == 0)
{
new_sync_method = SYNC_METHOD_FSYNC;
new_sync_bit = 0;
}
#ifdef HAVE_FDATASYNC
- else if (strcasecmp(method, "fdatasync") == 0)
+ else if (pg_strcasecmp(method, "fdatasync") == 0)
{
new_sync_method = SYNC_METHOD_FDATASYNC;
new_sync_bit = 0;
}
#endif
#ifdef OPEN_SYNC_FLAG
- else if (strcasecmp(method, "open_sync") == 0)
+ else if (pg_strcasecmp(method, "open_sync") == 0)
{
new_sync_method = SYNC_METHOD_OPEN;
new_sync_bit = OPEN_SYNC_FLAG;
}
#endif
#ifdef OPEN_DATASYNC_FLAG
- else if (strcasecmp(method, "open_datasync") == 0)
+ else if (pg_strcasecmp(method, "open_datasync") == 0)
{
new_sync_method = SYNC_METHOD_OPEN;
new_sync_bit = OPEN_DATASYNC_FLAG;
diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c
index 3dfacf7d186..d587245ef97 100644
--- a/src/backend/commands/aggregatecmds.c
+++ b/src/backend/commands/aggregatecmds.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.16 2003/11/29 19:51:47 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.17 2004/05/07 00:24:57 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -75,21 +75,21 @@ DefineAggregate(List *names, List *parameters)
* sfunc1, stype1, and initcond1 are accepted as obsolete
* spellings for sfunc, stype, initcond.
*/
- if (strcasecmp(defel->defname, "sfunc") == 0)
+ if (pg_strcasecmp(defel->defname, "sfunc") == 0)
transfuncName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "sfunc1") == 0)
+ else if (pg_strcasecmp(defel->defname, "sfunc1") == 0)
transfuncName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "finalfunc") == 0)
+ else if (pg_strcasecmp(defel->defname, "finalfunc") == 0)
finalfuncName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "basetype") == 0)
+ else if (pg_strcasecmp(defel->defname, "basetype") == 0)
baseType = defGetTypeName(defel);
- else if (strcasecmp(defel->defname, "stype") == 0)
+ else if (pg_strcasecmp(defel->defname, "stype") == 0)
transType = defGetTypeName(defel);
- else if (strcasecmp(defel->defname, "stype1") == 0)
+ else if (pg_strcasecmp(defel->defname, "stype1") == 0)
transType = defGetTypeName(defel);
- else if (strcasecmp(defel->defname, "initcond") == 0)
+ else if (pg_strcasecmp(defel->defname, "initcond") == 0)
initval = defGetString(defel);
- else if (strcasecmp(defel->defname, "initcond1") == 0)
+ else if (pg_strcasecmp(defel->defname, "initcond1") == 0)
initval = defGetString(defel);
else
ereport(WARNING,
@@ -124,7 +124,7 @@ DefineAggregate(List *names, List *parameters)
* be able to store values of the transtype. However, we can allow
* polymorphic transtype in some cases (AggregateCreate will check).
*/
- if (strcasecmp(TypeNameToString(baseType), "ANY") == 0)
+ if (pg_strcasecmp(TypeNameToString(baseType), "ANY") == 0)
baseTypeId = ANYOID;
else
baseTypeId = typenameTypeId(baseType);
diff --git a/src/backend/commands/define.c b/src/backend/commands/define.c
index fc24c2c30fb..19f14879a0e 100644
--- a/src/backend/commands/define.c
+++ b/src/backend/commands/define.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/define.c,v 1.86 2004/02/21 00:34:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/define.c,v 1.87 2004/05/07 00:24:57 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -240,12 +240,12 @@ defGetTypeLength(DefElem *def)
def->defname)));
break;
case T_String:
- if (strcasecmp(strVal(def->arg), "variable") == 0)
+ if (pg_strcasecmp(strVal(def->arg), "variable") == 0)
return -1; /* variable length */
break;
case T_TypeName:
/* cope if grammar chooses to believe "variable" is a typename */
- if (strcasecmp(TypeNameToString((TypeName *) def->arg),
+ if (pg_strcasecmp(TypeNameToString((TypeName *) def->arg),
"variable") == 0)
return -1; /* variable length */
break;
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index c91b31ed6fd..a0a9c582409 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.44 2004/02/21 00:34:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.45 2004/05/07 00:24:57 tgl Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
@@ -328,9 +328,9 @@ compute_attributes_with_style(List *parameters, bool *isStrict_p, char *volatili
{
DefElem *param = (DefElem *) lfirst(pl);
- if (strcasecmp(param->defname, "isstrict") == 0)
+ if (pg_strcasecmp(param->defname, "isstrict") == 0)
*isStrict_p = true;
- else if (strcasecmp(param->defname, "iscachable") == 0)
+ else if (pg_strcasecmp(param->defname, "iscachable") == 0)
{
/* obsolete spelling of isImmutable */
*volatility_p = PROVOLATILE_IMMUTABLE;
diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c
index 657e289fbb0..2736a31f3c0 100644
--- a/src/backend/commands/operatorcmds.c
+++ b/src/backend/commands/operatorcmds.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.13 2003/11/29 19:51:47 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.14 2004/05/07 00:24:57 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -97,7 +97,7 @@ DefineOperator(List *names, List *parameters)
{
DefElem *defel = (DefElem *) lfirst(pl);
- if (strcasecmp(defel->defname, "leftarg") == 0)
+ if (pg_strcasecmp(defel->defname, "leftarg") == 0)
{
typeName1 = defGetTypeName(defel);
if (typeName1->setof)
@@ -105,7 +105,7 @@ DefineOperator(List *names, List *parameters)
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("setof type not allowed for operator argument")));
}
- else if (strcasecmp(defel->defname, "rightarg") == 0)
+ else if (pg_strcasecmp(defel->defname, "rightarg") == 0)
{
typeName2 = defGetTypeName(defel);
if (typeName2->setof)
@@ -113,27 +113,27 @@ DefineOperator(List *names, List *parameters)
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("setof type not allowed for operator argument")));
}
- else if (strcasecmp(defel->defname, "procedure") == 0)
+ else if (pg_strcasecmp(defel->defname, "procedure") == 0)
functionName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "commutator") == 0)
+ else if (pg_strcasecmp(defel->defname, "commutator") == 0)
commutatorName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "negator") == 0)
+ else if (pg_strcasecmp(defel->defname, "negator") == 0)
negatorName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "restrict") == 0)
+ else if (pg_strcasecmp(defel->defname, "restrict") == 0)
restrictionName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "join") == 0)
+ else if (pg_strcasecmp(defel->defname, "join") == 0)
joinName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "hashes") == 0)
+ else if (pg_strcasecmp(defel->defname, "hashes") == 0)
canHash = TRUE;
- else if (strcasecmp(defel->defname, "merges") == 0)
+ else if (pg_strcasecmp(defel->defname, "merges") == 0)
canMerge = TRUE;
- else if (strcasecmp(defel->defname, "sort1") == 0)
+ else if (pg_strcasecmp(defel->defname, "sort1") == 0)
leftSortName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "sort2") == 0)
+ else if (pg_strcasecmp(defel->defname, "sort2") == 0)
rightSortName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "ltcmp") == 0)
+ else if (pg_strcasecmp(defel->defname, "ltcmp") == 0)
ltCompareName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "gtcmp") == 0)
+ else if (pg_strcasecmp(defel->defname, "gtcmp") == 0)
gtCompareName = defGetQualifiedName(defel);
else
ereport(WARNING,
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index f19645a8260..d74e1e7ab31 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.104 2004/05/06 16:10:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.105 2004/05/07 00:24:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3126,13 +3126,13 @@ ATExecSetStorage(Relation rel, const char *colName, Node *newValue)
Assert(IsA(newValue, String));
storagemode = strVal(newValue);
- if (strcasecmp(storagemode, "plain") == 0)
+ if (pg_strcasecmp(storagemode, "plain") == 0)
newstorage = 'p';
- else if (strcasecmp(storagemode, "external") == 0)
+ else if (pg_strcasecmp(storagemode, "external") == 0)
newstorage = 'e';
- else if (strcasecmp(storagemode, "extended") == 0)
+ else if (pg_strcasecmp(storagemode, "extended") == 0)
newstorage = 'x';
- else if (strcasecmp(storagemode, "main") == 0)
+ else if (pg_strcasecmp(storagemode, "main") == 0)
newstorage = 'm';
else
{
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index d76e048a3e7..411ad725bc8 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.54 2004/05/05 17:06:56 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.55 2004/05/07 00:24:57 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -142,28 +142,28 @@ DefineType(List *names, List *parameters)
{
DefElem *defel = (DefElem *) lfirst(pl);
- if (strcasecmp(defel->defname, "internallength") == 0)
+ if (pg_strcasecmp(defel->defname, "internallength") == 0)
internalLength = defGetTypeLength(defel);
- else if (strcasecmp(defel->defname, "externallength") == 0)
+ else if (pg_strcasecmp(defel->defname, "externallength") == 0)
; /* ignored -- remove after 7.3 */
- else if (strcasecmp(defel->defname, "input") == 0)
+ else if (pg_strcasecmp(defel->defname, "input") == 0)
inputName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "output") == 0)
+ else if (pg_strcasecmp(defel->defname, "output") == 0)
outputName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "receive") == 0)
+ else if (pg_strcasecmp(defel->defname, "receive") == 0)
receiveName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "send") == 0)
+ else if (pg_strcasecmp(defel->defname, "send") == 0)
sendName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "analyze") == 0 ||
- strcasecmp(defel->defname, "analyse") == 0)
+ else if (pg_strcasecmp(defel->defname, "analyze") == 0 ||
+ pg_strcasecmp(defel->defname, "analyse") == 0)
analyzeName = defGetQualifiedName(defel);
- else if (strcasecmp(defel->defname, "delimiter") == 0)
+ else if (pg_strcasecmp(defel->defname, "delimiter") == 0)
{
char *p = defGetString(defel);
delimiter = p[0];
}
- else if (strcasecmp(defel->defname, "element") == 0)
+ else if (pg_strcasecmp(defel->defname, "element") == 0)
{
elemType = typenameTypeId(defGetTypeName(defel));
/* disallow arrays of pseudotypes */
@@ -173,11 +173,11 @@ DefineType(List *names, List *parameters)
errmsg("array element type cannot be %s",
format_type_be(elemType))));
}
- else if (strcasecmp(defel->defname, "default") == 0)
+ else if (pg_strcasecmp(defel->defname, "default") == 0)
defaultValue = defGetString(defel);
- else if (strcasecmp(defel->defname, "passedbyvalue") == 0)
+ else if (pg_strcasecmp(defel->defname, "passedbyvalue") == 0)
byValue = true;
- else if (strcasecmp(defel->defname, "alignment") == 0)
+ else if (pg_strcasecmp(defel->defname, "alignment") == 0)
{
char *a = defGetString(defel);
@@ -187,35 +187,35 @@ DefineType(List *names, List *parameters)
* recognize translated type names as well as the nominal
* form.
*/
- if (strcasecmp(a, "double") == 0 ||
- strcasecmp(a, "float8") == 0 ||
- strcasecmp(a, "pg_catalog.float8") == 0)
+ if (pg_strcasecmp(a, "double") == 0 ||
+ pg_strcasecmp(a, "float8") == 0 ||
+ pg_strcasecmp(a, "pg_catalog.float8") == 0)
alignment = 'd';
- else if (strcasecmp(a, "int4") == 0 ||
- strcasecmp(a, "pg_catalog.int4") == 0)
+ else if (pg_strcasecmp(a, "int4") == 0 ||
+ pg_strcasecmp(a, "pg_catalog.int4") == 0)
alignment = 'i';
- else if (strcasecmp(a, "int2") == 0 ||
- strcasecmp(a, "pg_catalog.int2") == 0)
+ else if (pg_strcasecmp(a, "int2") == 0 ||
+ pg_strcasecmp(a, "pg_catalog.int2") == 0)
alignment = 's';
- else if (strcasecmp(a, "char") == 0 ||
- strcasecmp(a, "pg_catalog.bpchar") == 0)
+ else if (pg_strcasecmp(a, "char") == 0 ||
+ pg_strcasecmp(a, "pg_catalog.bpchar") == 0)
alignment = 'c';
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("alignment \"%s\" not recognized", a)));
}
- else if (strcasecmp(defel->defname, "storage") == 0)
+ else if (pg_strcasecmp(defel->defname, "storage") == 0)
{
char *a = defGetString(defel);
- if (strcasecmp(a, "plain") == 0)
+ if (pg_strcasecmp(a, "plain") == 0)
storage = 'p';
- else if (strcasecmp(a, "external") == 0)
+ else if (pg_strcasecmp(a, "external") == 0)
storage = 'e';
- else if (strcasecmp(a, "extended") == 0)
+ else if (pg_strcasecmp(a, "extended") == 0)
storage = 'x';
- else if (strcasecmp(a, "main") == 0)
+ else if (pg_strcasecmp(a, "main") == 0)
storage = 'm';
else
ereport(ERROR,
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 14c408e0010..f83ce51baca 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.93 2004/01/19 19:04:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.94 2004/05/07 00:24:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,6 +23,7 @@
#include "catalog/pg_shadow.h"
#include "commands/variable.h"
#include "miscadmin.h"
+#include "parser/scansup.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "utils/syscache.h"
@@ -82,22 +83,22 @@ assign_datestyle(const char *value, bool doit, GucSource source)
/* Ugh. Somebody ought to write a table driven version -- mjl */
- if (strcasecmp(tok, "ISO") == 0)
+ if (pg_strcasecmp(tok, "ISO") == 0)
{
newDateStyle = USE_ISO_DATES;
scnt++;
}
- else if (strcasecmp(tok, "SQL") == 0)
+ else if (pg_strcasecmp(tok, "SQL") == 0)
{
newDateStyle = USE_SQL_DATES;
scnt++;
}
- else if (strncasecmp(tok, "POSTGRES", 8) == 0)
+ else if (pg_strncasecmp(tok, "POSTGRES", 8) == 0)
{
newDateStyle = USE_POSTGRES_DATES;
scnt++;
}
- else if (strcasecmp(tok, "GERMAN") == 0)
+ else if (pg_strcasecmp(tok, "GERMAN") == 0)
{
newDateStyle = USE_GERMAN_DATES;
scnt++;
@@ -105,25 +106,25 @@ assign_datestyle(const char *value, bool doit, GucSource source)
if (ocnt == 0)
newDateOrder = DATEORDER_DMY;
}
- else if (strcasecmp(tok, "YMD") == 0)
+ else if (pg_strcasecmp(tok, "YMD") == 0)
{
newDateOrder = DATEORDER_YMD;
ocnt++;
}
- else if (strcasecmp(tok, "DMY") == 0 ||
- strncasecmp(tok, "EURO", 4) == 0)
+ else if (pg_strcasecmp(tok, "DMY") == 0 ||
+ pg_strncasecmp(tok, "EURO", 4) == 0)
{
newDateOrder = DATEORDER_DMY;
ocnt++;
}
- else if (strcasecmp(tok, "MDY") == 0 ||
- strcasecmp(tok, "US") == 0 ||
- strncasecmp(tok, "NONEURO", 7) == 0)
+ else if (pg_strcasecmp(tok, "MDY") == 0 ||
+ pg_strcasecmp(tok, "US") == 0 ||
+ pg_strncasecmp(tok, "NONEURO", 7) == 0)
{
newDateOrder = DATEORDER_MDY;
ocnt++;
}
- else if (strcasecmp(tok, "DEFAULT") == 0)
+ else if (pg_strcasecmp(tok, "DEFAULT") == 0)
{
/*
* Easiest way to get the current DEFAULT state is to fetch
@@ -321,8 +322,7 @@ clear_tz(void)
static bool
tzset_succeeded(const char *tz)
{
- char tztmp[TZBUF_LEN];
- char *cp;
+ char *tztmp;
int tzval;
/*
@@ -339,9 +339,7 @@ tzset_succeeded(const char *tz)
* Check for known spellings of "UTC". Note we must downcase the
* input before passing it to DecodePosixTimezone().
*/
- StrNCpy(tztmp, tz, sizeof(tztmp));
- for (cp = tztmp; *cp; cp++)
- *cp = tolower((unsigned char) *cp);
+ tztmp = downcase_truncate_identifier(tz, strlen(tz), false);
if (DecodePosixTimezone(tztmp, &tzval) == 0)
if (tzval == 0)
return true;
@@ -410,7 +408,7 @@ assign_timezone(const char *value, bool doit, GucSource source)
/*
* Check for INTERVAL 'foo'
*/
- if (strncasecmp(value, "interval", 8) == 0)
+ if (pg_strncasecmp(value, "interval", 8) == 0)
{
const char *valueptr = value;
char *val;
@@ -474,7 +472,7 @@ assign_timezone(const char *value, bool doit, GucSource source)
HasCTZSet = true;
}
}
- else if (strcasecmp(value, "UNKNOWN") == 0)
+ else if (pg_strcasecmp(value, "UNKNOWN") == 0)
{
/*
* UNKNOWN is the value shown as the "default" for TimeZone in
diff --git a/src/backend/regex/regc_locale.c b/src/backend/regex/regc_locale.c
index d3a7f3d1259..06c5f46a128 100644
--- a/src/backend/regex/regc_locale.c
+++ b/src/backend/regex/regc_locale.c
@@ -47,7 +47,7 @@
* permission to use and distribute the software in accordance with the
* terms specified in this license.
*
- * $PostgreSQL: pgsql/src/backend/regex/regc_locale.c,v 1.5 2003/11/29 19:51:55 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/regex/regc_locale.c,v 1.6 2004/05/07 00:24:57 tgl Exp $
*/
/* ASCII character-name table */
@@ -353,61 +353,61 @@ static struct cname
* some ctype functions with non-ascii-char guard
*/
static int
-pg_isdigit(pg_wchar c)
+pg_wc_isdigit(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isdigit((unsigned char) c));
}
static int
-pg_isalpha(pg_wchar c)
+pg_wc_isalpha(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isalpha((unsigned char) c));
}
static int
-pg_isalnum(pg_wchar c)
+pg_wc_isalnum(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isalnum((unsigned char) c));
}
static int
-pg_isupper(pg_wchar c)
+pg_wc_isupper(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isupper((unsigned char) c));
}
static int
-pg_islower(pg_wchar c)
+pg_wc_islower(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && islower((unsigned char) c));
}
static int
-pg_isgraph(pg_wchar c)
+pg_wc_isgraph(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isgraph((unsigned char) c));
}
static int
-pg_isprint(pg_wchar c)
+pg_wc_isprint(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isprint((unsigned char) c));
}
static int
-pg_ispunct(pg_wchar c)
+pg_wc_ispunct(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && ispunct((unsigned char) c));
}
static int
-pg_isspace(pg_wchar c)
+pg_wc_isspace(pg_wchar c)
{
return (c >= 0 && c <= UCHAR_MAX && isspace((unsigned char) c));
}
static pg_wchar
-pg_toupper(pg_wchar c)
+pg_wc_toupper(pg_wchar c)
{
if (c >= 0 && c <= UCHAR_MAX)
return toupper((unsigned char) c);
@@ -415,7 +415,7 @@ pg_toupper(pg_wchar c)
}
static pg_wchar
-pg_tolower(pg_wchar c)
+pg_wc_tolower(pg_wchar c)
{
if (c >= 0 && c <= UCHAR_MAX)
return tolower((unsigned char) c);
@@ -534,10 +534,10 @@ range(struct vars * v, /* context */
for (c = a; c <= b; c++)
{
addchr(cv, c);
- lc = pg_tolower((chr) c);
+ lc = pg_wc_tolower((chr) c);
if (c != lc)
addchr(cv, lc);
- uc = pg_toupper((chr) c);
+ uc = pg_wc_toupper((chr) c);
if (c != uc)
addchr(cv, uc);
}
@@ -668,7 +668,7 @@ cclass(struct vars * v, /* context */
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_isprint((chr) i))
+ if (pg_wc_isprint((chr) i))
addchr(cv, (chr) i);
}
}
@@ -679,7 +679,7 @@ cclass(struct vars * v, /* context */
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_isalnum((chr) i))
+ if (pg_wc_isalnum((chr) i))
addchr(cv, (chr) i);
}
}
@@ -690,7 +690,7 @@ cclass(struct vars * v, /* context */
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_isalpha((chr) i))
+ if (pg_wc_isalpha((chr) i))
addchr(cv, (chr) i);
}
}
@@ -721,7 +721,7 @@ cclass(struct vars * v, /* context */
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_ispunct((chr) i))
+ if (pg_wc_ispunct((chr) i))
addchr(cv, (chr) i);
}
}
@@ -741,7 +741,7 @@ cclass(struct vars * v, /* context */
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_isspace((chr) i))
+ if (pg_wc_isspace((chr) i))
addchr(cv, (chr) i);
}
}
@@ -752,7 +752,7 @@ cclass(struct vars * v, /* context */
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_islower((chr) i))
+ if (pg_wc_islower((chr) i))
addchr(cv, (chr) i);
}
}
@@ -763,7 +763,7 @@ cclass(struct vars * v, /* context */
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_isupper((chr) i))
+ if (pg_wc_isupper((chr) i))
addchr(cv, (chr) i);
}
}
@@ -774,7 +774,7 @@ cclass(struct vars * v, /* context */
{
for (i = 0; i <= UCHAR_MAX; i++)
{
- if (pg_isgraph((chr) i))
+ if (pg_wc_isgraph((chr) i))
addchr(cv, (chr) i);
}
}
@@ -800,8 +800,8 @@ allcases(struct vars * v, /* context */
chr lc,
uc;
- lc = pg_tolower((chr) c);
- uc = pg_toupper((chr) c);
+ lc = pg_wc_tolower((chr) c);
+ uc = pg_wc_toupper((chr) c);
cv = getcvec(v, 2, 0, 0);
addchr(cv, lc);
@@ -839,7 +839,7 @@ casecmp(const chr *x, const chr *y, /* strings to compare */
{
for (; len > 0; len--, x++, y++)
{
- if ((*x != *y) && (pg_tolower(*x) != pg_tolower(*y)))
+ if ((*x != *y) && (pg_wc_tolower(*x) != pg_wc_tolower(*y)))
return 1;
}
return 0;
diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c
index 4ace0f086e3..9d350683fcc 100644
--- a/src/backend/regex/regcomp.c
+++ b/src/backend/regex/regcomp.c
@@ -28,7 +28,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/src/backend/regex/regcomp.c,v 1.40 2003/11/29 19:51:55 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/regex/regcomp.c,v 1.41 2004/05/07 00:24:57 tgl Exp $
*
*/
@@ -178,17 +178,17 @@ static struct cvec *getcvec(struct vars *, int, int, int);
static void freecvec(struct cvec *);
/* === regc_locale.c === */
-static int pg_isdigit(pg_wchar c);
-static int pg_isalpha(pg_wchar c);
-static int pg_isalnum(pg_wchar c);
-static int pg_isupper(pg_wchar c);
-static int pg_islower(pg_wchar c);
-static int pg_isgraph(pg_wchar c);
-static int pg_isprint(pg_wchar c);
-static int pg_ispunct(pg_wchar c);
-static int pg_isspace(pg_wchar c);
-static pg_wchar pg_toupper(pg_wchar c);
-static pg_wchar pg_tolower(pg_wchar c);
+static int pg_wc_isdigit(pg_wchar c);
+static int pg_wc_isalpha(pg_wchar c);
+static int pg_wc_isalnum(pg_wchar c);
+static int pg_wc_isupper(pg_wchar c);
+static int pg_wc_islower(pg_wchar c);
+static int pg_wc_isgraph(pg_wchar c);
+static int pg_wc_isprint(pg_wchar c);
+static int pg_wc_ispunct(pg_wchar c);
+static int pg_wc_isspace(pg_wchar c);
+static pg_wchar pg_wc_toupper(pg_wchar c);
+static pg_wchar pg_wc_tolower(pg_wchar c);
static int nmcces(struct vars *);
static int nleaders(struct vars *);
static struct cvec *allmcces(struct vars *, struct cvec *);
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index 5883c188784..214bda2245a 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.103 2004/05/02 13:38:27 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.104 2004/05/07 00:24:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -882,29 +882,29 @@ convert_priv_string(text *priv_type_text)
priv_type = DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(priv_type_text)));
- if (strcasecmp(priv_type, "SELECT") == 0)
+ if (pg_strcasecmp(priv_type, "SELECT") == 0)
return ACL_SELECT;
- if (strcasecmp(priv_type, "INSERT") == 0)
+ if (pg_strcasecmp(priv_type, "INSERT") == 0)
return ACL_INSERT;
- if (strcasecmp(priv_type, "UPDATE") == 0)
+ if (pg_strcasecmp(priv_type, "UPDATE") == 0)
return ACL_UPDATE;
- if (strcasecmp(priv_type, "DELETE") == 0)
+ if (pg_strcasecmp(priv_type, "DELETE") == 0)
return ACL_DELETE;
- if (strcasecmp(priv_type, "RULE") == 0)
+ if (pg_strcasecmp(priv_type, "RULE") == 0)
return ACL_RULE;
- if (strcasecmp(priv_type, "REFERENCES") == 0)
+ if (pg_strcasecmp(priv_type, "REFERENCES") == 0)
return ACL_REFERENCES;
- if (strcasecmp(priv_type, "TRIGGER") == 0)
+ if (pg_strcasecmp(priv_type, "TRIGGER") == 0)
return ACL_TRIGGER;
- if (strcasecmp(priv_type, "EXECUTE") == 0)
+ if (pg_strcasecmp(priv_type, "EXECUTE") == 0)
return ACL_EXECUTE;
- if (strcasecmp(priv_type, "USAGE") == 0)
+ if (pg_strcasecmp(priv_type, "USAGE") == 0)
return ACL_USAGE;
- if (strcasecmp(priv_type, "CREATE") == 0)
+ if (pg_strcasecmp(priv_type, "CREATE") == 0)
return ACL_CREATE;
- if (strcasecmp(priv_type, "TEMP") == 0)
+ if (pg_strcasecmp(priv_type, "TEMP") == 0)
return ACL_CREATE_TEMP;
- if (strcasecmp(priv_type, "TEMPORARY") == 0)
+ if (pg_strcasecmp(priv_type, "TEMPORARY") == 0)
return ACL_CREATE_TEMP;
ereport(ERROR,
@@ -1097,39 +1097,39 @@ convert_table_priv_string(text *priv_type_text)
/*
* Return mode from priv_type string
*/
- if (strcasecmp(priv_type, "SELECT") == 0)
+ if (pg_strcasecmp(priv_type, "SELECT") == 0)
return ACL_SELECT;
- if (strcasecmp(priv_type, "SELECT WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "SELECT WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_SELECT);
- if (strcasecmp(priv_type, "INSERT") == 0)
+ if (pg_strcasecmp(priv_type, "INSERT") == 0)
return ACL_INSERT;
- if (strcasecmp(priv_type, "INSERT WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "INSERT WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_INSERT);
- if (strcasecmp(priv_type, "UPDATE") == 0)
+ if (pg_strcasecmp(priv_type, "UPDATE") == 0)
return ACL_UPDATE;
- if (strcasecmp(priv_type, "UPDATE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "UPDATE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_UPDATE);
- if (strcasecmp(priv_type, "DELETE") == 0)
+ if (pg_strcasecmp(priv_type, "DELETE") == 0)
return ACL_DELETE;
- if (strcasecmp(priv_type, "DELETE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "DELETE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_DELETE);
- if (strcasecmp(priv_type, "RULE") == 0)
+ if (pg_strcasecmp(priv_type, "RULE") == 0)
return ACL_RULE;
- if (strcasecmp(priv_type, "RULE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "RULE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_RULE);
- if (strcasecmp(priv_type, "REFERENCES") == 0)
+ if (pg_strcasecmp(priv_type, "REFERENCES") == 0)
return ACL_REFERENCES;
- if (strcasecmp(priv_type, "REFERENCES WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "REFERENCES WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_REFERENCES);
- if (strcasecmp(priv_type, "TRIGGER") == 0)
+ if (pg_strcasecmp(priv_type, "TRIGGER") == 0)
return ACL_TRIGGER;
- if (strcasecmp(priv_type, "TRIGGER WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "TRIGGER WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_TRIGGER);
ereport(ERROR,
@@ -1329,19 +1329,19 @@ convert_database_priv_string(text *priv_type_text)
/*
* Return mode from priv_type string
*/
- if (strcasecmp(priv_type, "CREATE") == 0)
+ if (pg_strcasecmp(priv_type, "CREATE") == 0)
return ACL_CREATE;
- if (strcasecmp(priv_type, "CREATE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "CREATE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_CREATE);
- if (strcasecmp(priv_type, "TEMPORARY") == 0)
+ if (pg_strcasecmp(priv_type, "TEMPORARY") == 0)
return ACL_CREATE_TEMP;
- if (strcasecmp(priv_type, "TEMPORARY WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "TEMPORARY WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_CREATE_TEMP);
- if (strcasecmp(priv_type, "TEMP") == 0)
+ if (pg_strcasecmp(priv_type, "TEMP") == 0)
return ACL_CREATE_TEMP;
- if (strcasecmp(priv_type, "TEMP WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "TEMP WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_CREATE_TEMP);
ereport(ERROR,
@@ -1543,9 +1543,9 @@ convert_function_priv_string(text *priv_type_text)
/*
* Return mode from priv_type string
*/
- if (strcasecmp(priv_type, "EXECUTE") == 0)
+ if (pg_strcasecmp(priv_type, "EXECUTE") == 0)
return ACL_EXECUTE;
- if (strcasecmp(priv_type, "EXECUTE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "EXECUTE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_EXECUTE);
ereport(ERROR,
@@ -1747,9 +1747,9 @@ convert_language_priv_string(text *priv_type_text)
/*
* Return mode from priv_type string
*/
- if (strcasecmp(priv_type, "USAGE") == 0)
+ if (pg_strcasecmp(priv_type, "USAGE") == 0)
return ACL_USAGE;
- if (strcasecmp(priv_type, "USAGE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "USAGE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_USAGE);
ereport(ERROR,
@@ -1951,14 +1951,14 @@ convert_schema_priv_string(text *priv_type_text)
/*
* Return mode from priv_type string
*/
- if (strcasecmp(priv_type, "CREATE") == 0)
+ if (pg_strcasecmp(priv_type, "CREATE") == 0)
return ACL_CREATE;
- if (strcasecmp(priv_type, "CREATE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "CREATE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_CREATE);
- if (strcasecmp(priv_type, "USAGE") == 0)
+ if (pg_strcasecmp(priv_type, "USAGE") == 0)
return ACL_USAGE;
- if (strcasecmp(priv_type, "USAGE WITH GRANT OPTION") == 0)
+ if (pg_strcasecmp(priv_type, "USAGE WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_USAGE);
ereport(ERROR,
diff --git a/src/backend/utils/adt/bool.c b/src/backend/utils/adt/bool.c
index 05f03c26344..ddb8c923591 100644
--- a/src/backend/utils/adt/bool.c
+++ b/src/backend/utils/adt/bool.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/bool.c,v 1.31 2003/11/29 19:51:58 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/bool.c,v 1.32 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,35 +39,35 @@ boolin(PG_FUNCTION_ARGS)
{
case 't':
case 'T':
- if (strncasecmp(b, "true", strlen(b)) == 0)
+ if (pg_strncasecmp(b, "true", strlen(b)) == 0)
PG_RETURN_BOOL(true);
break;
case 'f':
case 'F':
- if (strncasecmp(b, "false", strlen(b)) == 0)
+ if (pg_strncasecmp(b, "false", strlen(b)) == 0)
PG_RETURN_BOOL(false);
break;
case 'y':
case 'Y':
- if (strncasecmp(b, "yes", strlen(b)) == 0)
+ if (pg_strncasecmp(b, "yes", strlen(b)) == 0)
PG_RETURN_BOOL(true);
break;
case '1':
- if (strncasecmp(b, "1", strlen(b)) == 0)
+ if (pg_strncasecmp(b, "1", strlen(b)) == 0)
PG_RETURN_BOOL(true);
break;
case 'n':
case 'N':
- if (strncasecmp(b, "no", strlen(b)) == 0)
+ if (pg_strncasecmp(b, "no", strlen(b)) == 0)
PG_RETURN_BOOL(false);
break;
case '0':
- if (strncasecmp(b, "0", strlen(b)) == 0)
+ if (pg_strncasecmp(b, "0", strlen(b)) == 0)
PG_RETURN_BOOL(false);
break;
diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c
index dfe8331b010..166decb74e4 100644
--- a/src/backend/utils/adt/cash.c
+++ b/src/backend/utils/adt/cash.c
@@ -9,7 +9,7 @@
* workings can be found in the book "Software Solutions in C" by
* Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.62 2003/11/29 19:51:58 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.63 2004/05/07 00:24:58 tgl Exp $
*/
#include "postgres.h"
@@ -745,7 +745,7 @@ cash_words(PG_FUNCTION_ARGS)
strcat(buf, m0 == 1 ? " cent" : " cents");
/* capitalize output */
- buf[0] = toupper((unsigned char) buf[0]);
+ buf[0] = pg_toupper((unsigned char) buf[0]);
/* make a text type for output */
result = (text *) palloc(strlen(buf) + VARHDRSZ);
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index 9346f2ab68c..555ba5455ad 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.95 2004/02/14 20:16:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.96 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,6 +23,7 @@
#include "access/hash.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
+#include "parser/scansup.h"
#include "utils/builtins.h"
#include "utils/date.h"
#include "utils/nabstime.h"
@@ -1627,23 +1628,11 @@ time_part(PG_FUNCTION_ARGS)
float8 result;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
-
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("\"time\" units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
+ char *lowunits;
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
type = DecodeUnits(0, lowunits, &val);
if (type == UNKNOWN_FIELD)
@@ -2390,23 +2379,11 @@ timetz_part(PG_FUNCTION_ARGS)
float8 result;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
-
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("\"time with time zone\" units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
+ char *lowunits;
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
type = DecodeUnits(0, lowunits, &val);
if (type == UNKNOWN_FIELD)
@@ -2523,23 +2500,11 @@ timetz_zone(PG_FUNCTION_ARGS)
int tz;
int type,
val;
- int i;
- char *up,
- *lp,
- lowzone[MAXDATELEN + 1];
-
- if (VARSIZE(zone) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("time zone \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(zone))))));
+ char *lowzone;
- up = VARDATA(zone);
- lp = lowzone;
- for (i = 0; i < (VARSIZE(zone) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowzone = downcase_truncate_identifier(VARDATA(zone),
+ VARSIZE(zone) - VARHDRSZ,
+ false);
type = DecodeSpecial(0, lowzone, &val);
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index be764ce45e2..040e1691daf 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.126 2004/03/30 15:53:18 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.127 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -794,7 +794,7 @@ ParseDateTime(const char *timestr, char *lowstr,
{
ftype[nf] = DTK_DATE;
while (isalnum((unsigned char) *cp) || (*cp == delim))
- *lp++ = tolower((unsigned char) *cp++);
+ *lp++ = pg_tolower((unsigned char) *cp++);
}
}
@@ -822,9 +822,9 @@ ParseDateTime(const char *timestr, char *lowstr,
else if (isalpha((unsigned char) *cp))
{
ftype[nf] = DTK_STRING;
- *lp++ = tolower((unsigned char) *cp++);
+ *lp++ = pg_tolower((unsigned char) *cp++);
while (isalpha((unsigned char) *cp))
- *lp++ = tolower((unsigned char) *cp++);
+ *lp++ = pg_tolower((unsigned char) *cp++);
/*
* Full date string with leading text month? Could also be a
@@ -860,9 +860,9 @@ ParseDateTime(const char *timestr, char *lowstr,
else if (isalpha((unsigned char) *cp))
{
ftype[nf] = DTK_SPECIAL;
- *lp++ = tolower((unsigned char) *cp++);
+ *lp++ = pg_tolower((unsigned char) *cp++);
while (isalpha((unsigned char) *cp))
- *lp++ = tolower((unsigned char) *cp++);
+ *lp++ = pg_tolower((unsigned char) *cp++);
}
/* otherwise something wrong... */
else
diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c
index e7edc83f6fd..488afa09666 100644
--- a/src/backend/utils/adt/encode.c
+++ b/src/backend/utils/adt/encode.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/encode.c,v 1.10 2003/11/29 19:51:58 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/encode.c,v 1.11 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -549,7 +549,7 @@ pg_find_encoding(const char *name)
int i;
for (i = 0; enclist[i].name; i++)
- if (strcasecmp(enclist[i].name, name) == 0)
+ if (pg_strcasecmp(enclist[i].name, name) == 0)
return &enclist[i].enc;
return NULL;
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index a9032492155..c48af109e3e 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.103 2004/04/01 23:52:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.104 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -291,17 +291,17 @@ float4in(PG_FUNCTION_ARGS)
* set ERANGE anyway...) Therefore, we check for these inputs
* ourselves.
*/
- if (strncasecmp(num, "NaN", 3) == 0)
+ if (pg_strncasecmp(num, "NaN", 3) == 0)
{
val = get_float4_nan();
endptr = num + 3;
}
- else if (strncasecmp(num, "Infinity", 8) == 0)
+ else if (pg_strncasecmp(num, "Infinity", 8) == 0)
{
val = get_float4_infinity();
endptr = num + 8;
}
- else if (strncasecmp(num, "-Infinity", 9) == 0)
+ else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
{
val = - get_float4_infinity();
endptr = num + 9;
@@ -456,17 +456,17 @@ float8in(PG_FUNCTION_ARGS)
* set ERANGE anyway...) Therefore, we check for these inputs
* ourselves.
*/
- if (strncasecmp(num, "NaN", 3) == 0)
+ if (pg_strncasecmp(num, "NaN", 3) == 0)
{
val = get_float8_nan();
endptr = num + 3;
}
- else if (strncasecmp(num, "Infinity", 8) == 0)
+ else if (pg_strncasecmp(num, "Infinity", 8) == 0)
{
val = get_float8_infinity();
endptr = num + 8;
}
- else if (strncasecmp(num, "-Infinity", 9) == 0)
+ else if (pg_strncasecmp(num, "-Infinity", 9) == 0)
{
val = - get_float8_infinity();
endptr = num + 9;
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 3393a0ac4ce..6a9f26e0001 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------
* formatting.c
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.73 2004/03/30 15:53:18 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.74 2004/05/07 00:24:58 tgl Exp $
*
*
* Portions Copyright (c) 1999-2003, PostgreSQL Global Development Group
@@ -1477,7 +1477,7 @@ str_toupper(char *buff)
while (*p_buff)
{
- *p_buff = toupper((unsigned char) *p_buff);
+ *p_buff = pg_toupper((unsigned char) *p_buff);
++p_buff;
}
return buff;
@@ -1497,7 +1497,7 @@ str_tolower(char *buff)
while (*p_buff)
{
- *p_buff = tolower((unsigned char) *p_buff);
+ *p_buff = pg_tolower((unsigned char) *p_buff);
++p_buff;
}
return buff;
@@ -1523,9 +1523,9 @@ seq_search(char *name, char **array, int type, int max, int *len)
/* set first char */
if (type == ONE_UPPER || type == ALL_UPPER)
- *name = toupper((unsigned char) *name);
+ *name = pg_toupper((unsigned char) *name);
else if (type == ALL_LOWER)
- *name = tolower((unsigned char) *name);
+ *name = pg_tolower((unsigned char) *name);
for (last = 0, a = array; *a != NULL; a++)
{
@@ -1559,9 +1559,9 @@ seq_search(char *name, char **array, int type, int max, int *len)
if (i > last)
{
if (type == ONE_UPPER || type == ALL_LOWER)
- *n = tolower((unsigned char) *n);
+ *n = pg_tolower((unsigned char) *n);
else if (type == ALL_UPPER)
- *n = toupper((unsigned char) *n);
+ *n = pg_toupper((unsigned char) *n);
last = i;
}
@@ -2192,7 +2192,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node, void *data)
case DCH_month:
sprintf(inout, "%*s", S_FM(suf) ? 0 : -9, months_full[tm->tm_mon - 1]);
- *inout = tolower((unsigned char) *inout);
+ *inout = pg_tolower((unsigned char) *inout);
if (S_FM(suf))
return strlen(p_inout) - 1;
else
@@ -2209,7 +2209,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node, void *data)
case DCH_mon:
strcpy(inout, months[tm->tm_mon - 1]);
- *inout = tolower((unsigned char) *inout);
+ *inout = pg_tolower((unsigned char) *inout);
return 2;
case DCH_MM:
@@ -2255,7 +2255,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node, void *data)
case DCH_day:
sprintf(inout, "%*s", S_FM(suf) ? 0 : -9, days[tm->tm_wday]);
- *inout = tolower((unsigned char) *inout);
+ *inout = pg_tolower((unsigned char) *inout);
if (S_FM(suf))
return strlen(p_inout) - 1;
else
@@ -2272,7 +2272,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node, void *data)
case DCH_dy:
strcpy(inout, days[tm->tm_wday]);
- *inout = tolower((unsigned char) *inout);
+ *inout = pg_tolower((unsigned char) *inout);
return 2;
case DCH_DDD:
diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c
index 341bd9cc4c5..28390ee5c35 100644
--- a/src/backend/utils/adt/numeric.c
+++ b/src/backend/utils/adt/numeric.c
@@ -14,7 +14,7 @@
* Copyright (c) 1998-2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.72 2004/03/15 03:29:22 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.73 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -315,7 +315,7 @@ numeric_in(PG_FUNCTION_ARGS)
/*
* Check for NaN
*/
- if (strcasecmp(str, "NaN") == 0)
+ if (pg_strcasecmp(str, "NaN") == 0)
PG_RETURN_NUMERIC(make_result(&const_nan));
/*
diff --git a/src/backend/utils/adt/regexp.c b/src/backend/utils/adt/regexp.c
index cc26ab09d8c..6491bbca705 100644
--- a/src/backend/utils/adt/regexp.c
+++ b/src/backend/utils/adt/regexp.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.52 2004/02/03 17:52:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.53 2004/05/07 00:24:58 tgl Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
@@ -233,17 +233,17 @@ const char *
assign_regex_flavor(const char *value,
bool doit, GucSource source)
{
- if (strcasecmp(value, "advanced") == 0)
+ if (pg_strcasecmp(value, "advanced") == 0)
{
if (doit)
regex_flavor = REG_ADVANCED;
}
- else if (strcasecmp(value, "extended") == 0)
+ else if (pg_strcasecmp(value, "extended") == 0)
{
if (doit)
regex_flavor = REG_EXTENDED;
}
- else if (strcasecmp(value, "basic") == 0)
+ else if (pg_strcasecmp(value, "basic") == 0)
{
if (doit)
regex_flavor = REG_BASIC;
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c
index 40203161e7d..fe2e7aa6cf8 100644
--- a/src/backend/utils/adt/regproc.c
+++ b/src/backend/utils/adt/regproc.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/regproc.c,v 1.86 2004/01/31 05:09:40 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/regproc.c,v 1.87 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1259,7 +1259,7 @@ parseNameAndArgTypes(const char *string, const char *caller,
*ptr2 = '\0';
}
- if (allowNone && strcasecmp(typename, "none") == 0)
+ if (allowNone && pg_strcasecmp(typename, "none") == 0)
{
/* Special case for NONE */
typeid = InvalidOid;
diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c
index 0914abaaad9..8433bc98c4d 100644
--- a/src/backend/utils/adt/tid.c
+++ b/src/backend/utils/adt/tid.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/tid.c,v 1.42 2003/11/29 19:51:59 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/tid.c,v 1.43 2004/05/07 00:24:58 tgl Exp $
*
* NOTES
* input routine largely stolen from boxin().
@@ -218,7 +218,7 @@ currtid_for_view(Relation viewrel, ItemPointer tid)
for (i = 0; i < natts; i++)
{
- if (strcasecmp(NameStr(att->attrs[i]->attname), "ctid") == 0)
+ if (strcmp(NameStr(att->attrs[i]->attname), "ctid") == 0)
{
if (att->attrs[i]->atttypid != TIDOID)
elog(ERROR, "ctid isn't of type TID");
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index b2628a3a6f6..cd59b7f34ad 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.104 2004/04/10 18:02:59 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.105 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,6 +26,7 @@
#include "catalog/pg_type.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
+#include "parser/scansup.h"
#include "utils/array.h"
#include "utils/builtins.h"
@@ -2699,32 +2700,20 @@ timestamp_trunc(PG_FUNCTION_ARGS)
Timestamp result;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
+ char *lowunits;
fsec_t fsec;
struct tm tt,
*tm = &tt;
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("timestamp units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
+ if (TIMESTAMP_NOT_FINITE(timestamp))
+ PG_RETURN_TIMESTAMP(timestamp);
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
type = DecodeUnits(0, lowunits, &val);
- if (TIMESTAMP_NOT_FINITE(timestamp))
- PG_RETURN_TIMESTAMP(timestamp);
-
if (type == UNITS)
{
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
@@ -2814,32 +2803,21 @@ timestamptz_trunc(PG_FUNCTION_ARGS)
int tz;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
+ char *lowunits;
fsec_t fsec;
char *tzn;
struct tm tt,
*tm = &tt;
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("timestamp with time zone units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
-
- type = DecodeUnits(0, lowunits, &val);
-
if (TIMESTAMP_NOT_FINITE(timestamp))
PG_RETURN_TIMESTAMPTZ(timestamp);
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
+
+ type = DecodeUnits(0, lowunits, &val);
+
if (type == UNITS)
{
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
@@ -2929,27 +2907,16 @@ interval_trunc(PG_FUNCTION_ARGS)
Interval *result;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
+ char *lowunits;
fsec_t fsec;
struct tm tt,
*tm = &tt;
result = (Interval *) palloc(sizeof(Interval));
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("interval units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
type = DecodeUnits(0, lowunits, &val);
@@ -3173,36 +3140,25 @@ timestamp_part(PG_FUNCTION_ARGS)
float8 result;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
+ char *lowunits;
fsec_t fsec;
struct tm tt,
*tm = &tt;
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("timestamp units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
-
- type = DecodeUnits(0, lowunits, &val);
- if (type == UNKNOWN_FIELD)
- type = DecodeSpecial(0, lowunits, &val);
-
if (TIMESTAMP_NOT_FINITE(timestamp))
{
result = 0;
PG_RETURN_FLOAT8(result);
}
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
+
+ type = DecodeUnits(0, lowunits, &val);
+ if (type == UNKNOWN_FIELD)
+ type = DecodeSpecial(0, lowunits, &val);
+
if (type == UNITS)
{
if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL) != 0)
@@ -3395,38 +3351,27 @@ timestamptz_part(PG_FUNCTION_ARGS)
int tz;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
+ char *lowunits;
double dummy;
fsec_t fsec;
char *tzn;
struct tm tt,
*tm = &tt;
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("timestamp with time zone units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
-
- type = DecodeUnits(0, lowunits, &val);
- if (type == UNKNOWN_FIELD)
- type = DecodeSpecial(0, lowunits, &val);
-
if (TIMESTAMP_NOT_FINITE(timestamp))
{
result = 0;
PG_RETURN_FLOAT8(result);
}
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
+
+ type = DecodeUnits(0, lowunits, &val);
+ if (type == UNKNOWN_FIELD)
+ type = DecodeSpecial(0, lowunits, &val);
+
if (type == UNITS)
{
if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn) != 0)
@@ -3597,25 +3542,14 @@ interval_part(PG_FUNCTION_ARGS)
float8 result;
int type,
val;
- int i;
- char *up,
- *lp,
- lowunits[MAXDATELEN + 1];
+ char *lowunits;
fsec_t fsec;
struct tm tt,
*tm = &tt;
- if (VARSIZE(units) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("interval units \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(units))))));
- up = VARDATA(units);
- lp = lowunits;
- for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowunits = downcase_truncate_identifier(VARDATA(units),
+ VARSIZE(units) - VARHDRSZ,
+ false);
type = DecodeUnits(0, lowunits, &val);
if (type == UNKNOWN_FIELD)
@@ -3744,26 +3678,14 @@ timestamp_zone(PG_FUNCTION_ARGS)
int tz;
int type,
val;
- int i;
- char *up,
- *lp,
- lowzone[MAXDATELEN + 1];
-
- if (VARSIZE(zone) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("time zone \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(zone))))));
+ char *lowzone;
if (TIMESTAMP_NOT_FINITE(timestamp))
PG_RETURN_TIMESTAMPTZ(timestamp);
- up = VARDATA(zone);
- lp = lowzone;
- for (i = 0; i < (VARSIZE(zone) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
+ lowzone = downcase_truncate_identifier(VARDATA(zone),
+ VARSIZE(zone) - VARHDRSZ,
+ false);
type = DecodeSpecial(0, lowzone, &val);
@@ -3903,28 +3825,17 @@ timestamptz_zone(PG_FUNCTION_ARGS)
int tz;
int type,
val;
- int i;
- char *up,
- *lp,
- lowzone[MAXDATELEN + 1];
-
- if (VARSIZE(zone) - VARHDRSZ > MAXDATELEN)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("time zone \"%s\" not recognized",
- DatumGetCString(DirectFunctionCall1(textout,
- PointerGetDatum(zone))))));
- up = VARDATA(zone);
- lp = lowzone;
- for (i = 0; i < (VARSIZE(zone) - VARHDRSZ); i++)
- *lp++ = tolower((unsigned char) *up++);
- *lp = '\0';
-
- type = DecodeSpecial(0, lowzone, &val);
+ char *lowzone;
if (TIMESTAMP_NOT_FINITE(timestamp))
PG_RETURN_NULL();
+ lowzone = downcase_truncate_identifier(VARDATA(zone),
+ VARSIZE(zone) - VARHDRSZ,
+ false);
+
+ type = DecodeSpecial(0, lowzone, &val);
+
if ((type == TZ) || (type == DTZ))
{
tz = val * 60;
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 234bc4af39f..012842b61d9 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.135 2004/04/22 03:51:09 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.136 2004/05/07 00:24:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1010,21 +1010,21 @@ write_syslog(int level, const char *line)
if (!openlog_done)
{
- if (strcasecmp(Syslog_facility, "LOCAL0") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL0") == 0)
syslog_fac = LOG_LOCAL0;
- if (strcasecmp(Syslog_facility, "LOCAL1") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL1") == 0)
syslog_fac = LOG_LOCAL1;
- if (strcasecmp(Syslog_facility, "LOCAL2") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL2") == 0)
syslog_fac = LOG_LOCAL2;
- if (strcasecmp(Syslog_facility, "LOCAL3") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL3") == 0)
syslog_fac = LOG_LOCAL3;
- if (strcasecmp(Syslog_facility, "LOCAL4") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL4") == 0)
syslog_fac = LOG_LOCAL4;
- if (strcasecmp(Syslog_facility, "LOCAL5") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL5") == 0)
syslog_fac = LOG_LOCAL5;
- if (strcasecmp(Syslog_facility, "LOCAL6") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL6") == 0)
syslog_fac = LOG_LOCAL6;
- if (strcasecmp(Syslog_facility, "LOCAL7") == 0)
+ if (pg_strcasecmp(Syslog_facility, "LOCAL7") == 0)
syslog_fac = LOG_LOCAL7;
openlog(Syslog_ident, LOG_PID | LOG_NDELAY, syslog_fac);
openlog_done = true;
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 8c7106110cd..d7961eff421 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.201 2004/04/19 21:22:14 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.202 2004/05/07 00:24:58 tgl Exp $
*
*--------------------------------------------------------------------
*/
@@ -2443,45 +2443,45 @@ parse_bool(const char *value, bool *result)
{
size_t len = strlen(value);
- if (strncasecmp(value, "true", len) == 0)
+ if (pg_strncasecmp(value, "true", len) == 0)
{
if (result)
*result = true;
}
- else if (strncasecmp(value, "false", len) == 0)
+ else if (pg_strncasecmp(value, "false", len) == 0)
{
if (result)
*result = false;
}
- else if (strncasecmp(value, "yes", len) == 0)
+ else if (pg_strncasecmp(value, "yes", len) == 0)
{
if (result)
*result = true;
}
- else if (strncasecmp(value, "no", len) == 0)
+ else if (pg_strncasecmp(value, "no", len) == 0)
{
if (result)
*result = false;
}
- else if (strcasecmp(value, "on") == 0)
+ else if (pg_strcasecmp(value, "on") == 0)
{
if (result)
*result = true;
}
- else if (strcasecmp(value, "off") == 0)
+ else if (pg_strcasecmp(value, "off") == 0)
{
if (result)
*result = false;
}
- else if (strcasecmp(value, "1") == 0)
+ else if (pg_strcasecmp(value, "1") == 0)
{
if (result)
*result = true;
}
- else if (strcasecmp(value, "0") == 0)
+ else if (pg_strcasecmp(value, "0") == 0)
{
if (result)
*result = false;
@@ -3463,7 +3463,7 @@ set_config_by_name(PG_FUNCTION_ARGS)
void
GetPGVariable(const char *name, DestReceiver *dest)
{
- if (strcasecmp(name, "all") == 0)
+ if (pg_strcasecmp(name, "all") == 0)
ShowAllGUCConfig(dest);
else
ShowGUCConfigOption(name, dest);
@@ -3474,7 +3474,7 @@ GetPGVariableResultDesc(const char *name)
{
TupleDesc tupdesc;
- if (strcasecmp(name, "all") == 0)
+ if (pg_strcasecmp(name, "all") == 0)
{
/* need a tuple descriptor representing two TEXT columns */
tupdesc = CreateTemplateTupleDesc(2, false);
@@ -3504,7 +3504,7 @@ GetPGVariableResultDesc(const char *name)
void
ResetPGVariable(const char *name)
{
- if (strcasecmp(name, "all") == 0)
+ if (pg_strcasecmp(name, "all") == 0)
ResetAllOptions();
else
set_config_option(name,
@@ -4455,14 +4455,14 @@ assign_log_destination(const char *value, bool doit, GucSource source)
{
char *tok = (char *) lfirst(l);
- if (strcasecmp(tok,"stderr") == 0)
+ if (pg_strcasecmp(tok,"stderr") == 0)
newlogdest |= LOG_DESTINATION_STDERR;
#ifdef HAVE_SYSLOG
- else if (strcasecmp(tok,"syslog") == 0)
+ else if (pg_strcasecmp(tok,"syslog") == 0)
newlogdest |= LOG_DESTINATION_SYSLOG;
#endif
#ifdef WIN32
- else if (strcasecmp(tok,"eventlog") == 0)
+ else if (pg_strcasecmp(tok,"eventlog") == 0)
newlogdest |= LOG_DESTINATION_EVENTLOG;
#endif
else {
@@ -4494,21 +4494,21 @@ assign_log_destination(const char *value, bool doit, GucSource source)
static const char *
assign_facility(const char *facility, bool doit, GucSource source)
{
- if (strcasecmp(facility, "LOCAL0") == 0)
+ if (pg_strcasecmp(facility, "LOCAL0") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL1") == 0)
+ if (pg_strcasecmp(facility, "LOCAL1") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL2") == 0)
+ if (pg_strcasecmp(facility, "LOCAL2") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL3") == 0)
+ if (pg_strcasecmp(facility, "LOCAL3") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL4") == 0)
+ if (pg_strcasecmp(facility, "LOCAL4") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL5") == 0)
+ if (pg_strcasecmp(facility, "LOCAL5") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL6") == 0)
+ if (pg_strcasecmp(facility, "LOCAL6") == 0)
return facility;
- if (strcasecmp(facility, "LOCAL7") == 0)
+ if (pg_strcasecmp(facility, "LOCAL7") == 0)
return facility;
return NULL;
}
@@ -4518,22 +4518,22 @@ assign_facility(const char *facility, bool doit, GucSource source)
static const char *
assign_defaultxactisolevel(const char *newval, bool doit, GucSource source)
{
- if (strcasecmp(newval, "serializable") == 0)
+ if (pg_strcasecmp(newval, "serializable") == 0)
{
if (doit)
DefaultXactIsoLevel = XACT_SERIALIZABLE;
}
- else if (strcasecmp(newval, "repeatable read") == 0)
+ else if (pg_strcasecmp(newval, "repeatable read") == 0)
{
if (doit)
DefaultXactIsoLevel = XACT_REPEATABLE_READ;
}
- else if (strcasecmp(newval, "read committed") == 0)
+ else if (pg_strcasecmp(newval, "read committed") == 0)
{
if (doit)
DefaultXactIsoLevel = XACT_READ_COMMITTED;
}
- else if (strcasecmp(newval, "read uncommitted") == 0)
+ else if (pg_strcasecmp(newval, "read uncommitted") == 0)
{
if (doit)
DefaultXactIsoLevel = XACT_READ_UNCOMMITTED;
@@ -4566,68 +4566,68 @@ assign_min_error_statement(const char *newval, bool doit, GucSource source)
static const char *
assign_msglvl(int *var, const char *newval, bool doit, GucSource source)
{
- if (strcasecmp(newval, "debug") == 0)
+ if (pg_strcasecmp(newval, "debug") == 0)
{
if (doit)
(*var) = DEBUG2;
}
- else if (strcasecmp(newval, "debug5") == 0)
+ else if (pg_strcasecmp(newval, "debug5") == 0)
{
if (doit)
(*var) = DEBUG5;
}
- else if (strcasecmp(newval, "debug4") == 0)
+ else if (pg_strcasecmp(newval, "debug4") == 0)
{
if (doit)
(*var) = DEBUG4;
}
- else if (strcasecmp(newval, "debug3") == 0)
+ else if (pg_strcasecmp(newval, "debug3") == 0)
{
if (doit)
(*var) = DEBUG3;
}
- else if (strcasecmp(newval, "debug2") == 0)
+ else if (pg_strcasecmp(newval, "debug2") == 0)
{
if (doit)
(*var) = DEBUG2;
}
- else if (strcasecmp(newval, "debug1") == 0)
+ else if (pg_strcasecmp(newval, "debug1") == 0)
{
if (doit)
(*var) = DEBUG1;
}
- else if (strcasecmp(newval, "log") == 0)
+ else if (pg_strcasecmp(newval, "log") == 0)
{
if (doit)
(*var) = LOG;
}
- else if (strcasecmp(newval, "info") == 0)
+ else if (pg_strcasecmp(newval, "info") == 0)
{
if (doit)
(*var) = INFO;
}
- else if (strcasecmp(newval, "notice") == 0)
+ else if (pg_strcasecmp(newval, "notice") == 0)
{
if (doit)
(*var) = NOTICE;
}
- else if (strcasecmp(newval, "warning") == 0)
+ else if (pg_strcasecmp(newval, "warning") == 0)
{
if (doit)
(*var) = WARNING;
}
- else if (strcasecmp(newval, "error") == 0)
+ else if (pg_strcasecmp(newval, "error") == 0)
{
if (doit)
(*var) = ERROR;
}
/* We allow FATAL/PANIC for client-side messages too. */
- else if (strcasecmp(newval, "fatal") == 0)
+ else if (pg_strcasecmp(newval, "fatal") == 0)
{
if (doit)
(*var) = FATAL;
}
- else if (strcasecmp(newval, "panic") == 0)
+ else if (pg_strcasecmp(newval, "panic") == 0)
{
if (doit)
(*var) = PANIC;
@@ -4640,17 +4640,17 @@ assign_msglvl(int *var, const char *newval, bool doit, GucSource source)
static const char *
assign_log_error_verbosity(const char *newval, bool doit, GucSource source)
{
- if (strcasecmp(newval, "terse") == 0)
+ if (pg_strcasecmp(newval, "terse") == 0)
{
if (doit)
Log_error_verbosity = PGERROR_TERSE;
}
- else if (strcasecmp(newval, "default") == 0)
+ else if (pg_strcasecmp(newval, "default") == 0)
{
if (doit)
Log_error_verbosity = PGERROR_DEFAULT;
}
- else if (strcasecmp(newval, "verbose") == 0)
+ else if (pg_strcasecmp(newval, "verbose") == 0)
{
if (doit)
Log_error_verbosity = PGERROR_VERBOSE;
@@ -4669,22 +4669,22 @@ assign_log_statement(const char *newval, bool doit, GucSource source)
static const char *
assign_log_stmtlvl(int *var, const char *newval, bool doit, GucSource source)
{
- if (strcasecmp(newval, "none") == 0)
+ if (pg_strcasecmp(newval, "none") == 0)
{
if (doit)
(*var) = LOGSTMT_NONE;
}
- else if (strcasecmp(newval, "mod") == 0)
+ else if (pg_strcasecmp(newval, "mod") == 0)
{
if (doit)
(*var) = LOGSTMT_MOD;
}
- else if (strcasecmp(newval, "ddl") == 0)
+ else if (pg_strcasecmp(newval, "ddl") == 0)
{
if (doit)
(*var) = LOGSTMT_DDL;
}
- else if (strcasecmp(newval, "all") == 0)
+ else if (pg_strcasecmp(newval, "all") == 0)
{
if (doit)
(*var) = LOGSTMT_ALL;