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 * AUTHORDATEMAJOR EVENT
@@ -4010,7 +4010,7 @@ character: CHARACTER opt_varying opt_charset
40104010char *type, *c;
40114011if (($3 ==NULL ) || (strcasecmp($3 ," sql_text" ) ==0 )) {
40124012if ($2 ) type = xlateSqlType(" varchar" );
4013- else type = xlateSqlType(" char " );
4013+ else type = xlateSqlType(" bpchar " );
40144014}else {
40154015if ($2 ) {
40164016c = 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
40324032opt_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*/
55565561static char *
55575562xlateSqlType (char *name)
@@ -5566,8 +5571,6 @@ xlateSqlType(char *name)
55665571return " float8" ;
55675572else if (!strcasecmp (name," decimal" ))
55685573return " numeric" ;
5569- else if (!strcasecmp (name," char" ))
5570- return " bpchar" ;
55715574else if (!strcasecmp (name," datetime" ))
55725575return " timestamp" ;
55735576else if (!strcasecmp (name," timespan" ))