aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/define.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-02-21 00:34:53 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-02-21 00:34:53 +0000
commit59f9a0b9df0d224bb62ff8ec5b65e0b187655742 (patch)
tree17fc75064e4925afc08824727e41dfcc9c29f3a3 /src/backend/commands/define.c
parent1d567aee070b7a51fbdc74821237d5a5ae2caf8f (diff)
downloadpostgresql-59f9a0b9df0d224bb62ff8ec5b65e0b187655742.tar.gz
postgresql-59f9a0b9df0d224bb62ff8ec5b65e0b187655742.zip
Implement a solution to the 'Turkish locale downcases I incorrectly'
problem, per previous discussion. Make some additional changes to centralize the knowledge of just how identifier downcasing is done, in hopes of simplifying any future tweaking in this area.
Diffstat (limited to 'src/backend/commands/define.c')
-rw-r--r--src/backend/commands/define.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/backend/commands/define.c b/src/backend/commands/define.c
index 8e30d53d3dd..fc24c2c30fb 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.85 2003/11/29 19:51:47 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/define.c,v 1.86 2004/02/21 00:34:52 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -38,24 +38,19 @@
#include "catalog/namespace.h"
#include "commands/defrem.h"
#include "parser/parse_type.h"
+#include "parser/scansup.h"
#include "utils/int8.h"
/*
- * Translate the input language name to lower case.
+ * Translate the input language name to lower case, and truncate if needed.
*
- * Output buffer must be NAMEDATALEN long.
+ * Returns a palloc'd string
*/
-void
-case_translate_language_name(const char *input, char *output)
+char *
+case_translate_language_name(const char *input)
{
- int i;
-
- MemSet(output, 0, NAMEDATALEN); /* ensure result Name is
- * zero-filled */
-
- for (i = 0; i < NAMEDATALEN - 1 && input[i]; ++i)
- output[i] = tolower((unsigned char) input[i]);
+ return downcase_truncate_identifier(input, strlen(input), false);
}