mirror of
https://github.com/postgres/postgres.git
synced 2025-05-28 05:21:27 +03:00
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).
This commit is contained in:
parent
664908f564
commit
6f11af0c62
@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
@ -4010,7 +4010,7 @@ character: CHARACTER opt_varying opt_charset
|
|||||||
char *type, *c;
|
char *type, *c;
|
||||||
if (($3 == NULL) || (strcasecmp($3, "sql_text") == 0)) {
|
if (($3 == NULL) || (strcasecmp($3, "sql_text") == 0)) {
|
||||||
if ($2) type = xlateSqlType("varchar");
|
if ($2) type = xlateSqlType("varchar");
|
||||||
else type = xlateSqlType("char");
|
else type = xlateSqlType("bpchar");
|
||||||
} else {
|
} else {
|
||||||
if ($2) {
|
if ($2) {
|
||||||
c = palloc(strlen("var") + strlen($3) + 1);
|
c = palloc(strlen("var") + strlen($3) + 1);
|
||||||
@ -4023,10 +4023,10 @@ character: CHARACTER opt_varying opt_charset
|
|||||||
};
|
};
|
||||||
$$ = type;
|
$$ = type;
|
||||||
}
|
}
|
||||||
| CHAR opt_varying { $$ = xlateSqlType($2? "varchar": "char"); }
|
| CHAR opt_varying { $$ = xlateSqlType($2? "varchar": "bpchar"); }
|
||||||
| VARCHAR { $$ = xlateSqlType("varchar"); }
|
| VARCHAR { $$ = xlateSqlType("varchar"); }
|
||||||
| NATIONAL CHARACTER opt_varying { $$ = xlateSqlType($3? "varchar": "char"); }
|
| NATIONAL CHARACTER opt_varying { $$ = xlateSqlType($3? "varchar": "bpchar"); }
|
||||||
| NCHAR opt_varying { $$ = xlateSqlType($2? "varchar": "char"); }
|
| NCHAR opt_varying { $$ = xlateSqlType($2? "varchar": "bpchar"); }
|
||||||
;
|
;
|
||||||
|
|
||||||
opt_varying: VARYING { $$ = TRUE; }
|
opt_varying: VARYING { $$ = TRUE; }
|
||||||
@ -5536,7 +5536,8 @@ mapTargetColumns(List *src, List *dst)
|
|||||||
|
|
||||||
|
|
||||||
/* xlateSqlFunc()
|
/* 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
|
* Do not convert "float", since that is handled elsewhere
|
||||||
* for FLOAT(p) syntax.
|
* for FLOAT(p) syntax.
|
||||||
*/
|
*/
|
||||||
@ -5552,6 +5553,10 @@ xlateSqlFunc(char *name)
|
|||||||
|
|
||||||
/* xlateSqlType()
|
/* xlateSqlType()
|
||||||
* Convert alternate type names to internal Postgres types.
|
* 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 *
|
static char *
|
||||||
xlateSqlType(char *name)
|
xlateSqlType(char *name)
|
||||||
@ -5566,8 +5571,6 @@ xlateSqlType(char *name)
|
|||||||
return "float8";
|
return "float8";
|
||||||
else if (!strcasecmp(name, "decimal"))
|
else if (!strcasecmp(name, "decimal"))
|
||||||
return "numeric";
|
return "numeric";
|
||||||
else if (!strcasecmp(name, "char"))
|
|
||||||
return "bpchar";
|
|
||||||
else if (!strcasecmp(name, "datetime"))
|
else if (!strcasecmp(name, "datetime"))
|
||||||
return "timestamp";
|
return "timestamp";
|
||||||
else if (!strcasecmp(name, "timespan"))
|
else if (!strcasecmp(name, "timespan"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user