Skip to content

Commit 6f11af0

Browse files
committed
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).
1 parent 664908f commit 6f11af0

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/backend/parser/gram.y

+11-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.151 2000/02/24 16:34:21 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.152 2000/02/26 18:13:41 tgl Exp $
1515
*
1616
* HISTORY
1717
* AUTHOR DATE MAJOR EVENT
@@ -4010,7 +4010,7 @@ character: CHARACTER opt_varying opt_charset
40104010
char *type, *c;
40114011
if (($3 == NULL) || (strcasecmp($3, "sql_text") == 0)) {
40124012
if ($2) type = xlateSqlType("varchar");
4013-
else type = xlateSqlType("char");
4013+
else type = xlateSqlType("bpchar");
40144014
} else {
40154015
if ($2) {
40164016
c = palloc(strlen("var") + strlen($3) + 1);
@@ -4023,10 +4023,10 @@ character: CHARACTER opt_varying opt_charset
40234023
};
40244024
$$ = type;
40254025
}
4026-
| CHAR opt_varying { $$ = xlateSqlType($2? "varchar": "char"); }
4026+
| CHAR opt_varying { $$ = xlateSqlType($2? "varchar": "bpchar"); }
40274027
| VARCHAR { $$ = xlateSqlType("varchar"); }
4028-
| NATIONAL CHARACTER opt_varying { $$ = xlateSqlType($3? "varchar": "char"); }
4029-
| NCHAR opt_varying { $$ = xlateSqlType($2? "varchar": "char"); }
4028+
| NATIONAL CHARACTER opt_varying { $$ = xlateSqlType($3? "varchar": "bpchar"); }
4029+
| NCHAR opt_varying { $$ = xlateSqlType($2? "varchar": "bpchar"); }
40304030
;
40314031

40324032
opt_varying: VARYING { $$ = TRUE; }
@@ -5536,7 +5536,8 @@ mapTargetColumns(List *src, List *dst)
55365536

55375537

55385538
/* xlateSqlFunc()
5539-
* Convert alternate type names to internal Postgres types.
5539+
* Convert alternate function names to internal Postgres functions.
5540+
*
55405541
* Do not convert "float", since that is handled elsewhere
55415542
* for FLOAT(p) syntax.
55425543
*/
@@ -5552,6 +5553,10 @@ xlateSqlFunc(char *name)
55525553

55535554
/* xlateSqlType()
55545555
* Convert alternate type names to internal Postgres types.
5556+
*
5557+
* NB: do NOT put "char" -> "bpchar" here, because that renders it impossible
5558+
* to refer to our single-byte char type, even with quotes. (Without quotes,
5559+
* CHAR is a keyword, and the code above produces "bpchar" for it.)
55555560
*/
55565561
static char *
55575562
xlateSqlType(char *name)
@@ -5566,8 +5571,6 @@ xlateSqlType(char *name)
55665571
return "float8";
55675572
else if (!strcasecmp(name, "decimal"))
55685573
return "numeric";
5569-
else if (!strcasecmp(name, "char"))
5570-
return "bpchar";
55715574
else if (!strcasecmp(name, "datetime"))
55725575
return "timestamp";
55735576
else if (!strcasecmp(name, "timespan"))

0 commit comments

Comments
 (0)