aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-02-26 18:13:41 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-02-26 18:13:41 +0000
commit6f11af0c62ac66e0878bd0a6eae637c427355c69 (patch)
tree8a66b504d7b5d91df670316b75d1cc10aa69d3c4
parent664908f5643f2d79f55cfb802ba55d7bce7e41ad (diff)
downloadpostgresql-6f11af0c62ac66e0878bd0a6eae637c427355c69.tar.gz
postgresql-6f11af0c62ac66e0878bd0a6eae637c427355c69.zip
I had managed to break acceptance of "char", which worked in 6.5 to
refer to the single-byte char type. 7.0 was taking it as bpchar(1).
-rw-r--r--src/backend/parser/gram.y19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index d46417de192..b39f2cf175e 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.151 2000/02/24 16:34:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.152 2000/02/26 18:13:41 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -4010,7 +4010,7 @@ character: CHARACTER opt_varying opt_charset
char *type, *c;
if (($3 == NULL) || (strcasecmp($3, "sql_text") == 0)) {
if ($2) type = xlateSqlType("varchar");
- else type = xlateSqlType("char");
+ else type = xlateSqlType("bpchar");
} else {
if ($2) {
c = palloc(strlen("var") + strlen($3) + 1);
@@ -4023,10 +4023,10 @@ character: CHARACTER opt_varying opt_charset
};
$$ = type;
}
- | CHAR opt_varying { $$ = xlateSqlType($2? "varchar": "char"); }
+ | CHAR opt_varying { $$ = xlateSqlType($2? "varchar": "bpchar"); }
| VARCHAR { $$ = xlateSqlType("varchar"); }
- | NATIONAL CHARACTER opt_varying { $$ = xlateSqlType($3? "varchar": "char"); }
- | NCHAR opt_varying { $$ = xlateSqlType($2? "varchar": "char"); }
+ | NATIONAL CHARACTER opt_varying { $$ = xlateSqlType($3? "varchar": "bpchar"); }
+ | NCHAR opt_varying { $$ = xlateSqlType($2? "varchar": "bpchar"); }
;
opt_varying: VARYING { $$ = TRUE; }
@@ -5536,7 +5536,8 @@ mapTargetColumns(List *src, List *dst)
/* xlateSqlFunc()
- * Convert alternate type names to internal Postgres types.
+ * Convert alternate function names to internal Postgres functions.
+ *
* Do not convert "float", since that is handled elsewhere
* for FLOAT(p) syntax.
*/
@@ -5552,6 +5553,10 @@ xlateSqlFunc(char *name)
/* xlateSqlType()
* Convert alternate type names to internal Postgres types.
+ *
+ * NB: do NOT put "char" -> "bpchar" here, because that renders it impossible
+ * to refer to our single-byte char type, even with quotes. (Without quotes,
+ * CHAR is a keyword, and the code above produces "bpchar" for it.)
*/
static char *
xlateSqlType(char *name)
@@ -5566,8 +5571,6 @@ xlateSqlType(char *name)
return "float8";
else if (!strcasecmp(name, "decimal"))
return "numeric";
- else if (!strcasecmp(name, "char"))
- return "bpchar";
else if (!strcasecmp(name, "datetime"))
return "timestamp";
else if (!strcasecmp(name, "timespan"))