Skip to content

Commit 11324e4

Browse files
committed
Remove vestigial grammar support for CHARACTER ... CHARACTER SET option.
The SQL standard says that you should be able to write "CHARACTER SET foo" as part of the declaration of a char-type column. We don't implement that, but a rough form of support has existed in gram.y since commit f10b639. That's now sat there for nigh 20 years without anyone fleshing it out --- and even if someone did, the contemplated approach of having separate data type name(s) for every character set certainly isn't what we'd do today. Let's just remove the grammar production; if anyone is ever motivated to work on this, reinventing the grammar support is a trivial fraction of what they'd have to do. And we've never documented anything about supporting such a clause. Per gripe from Neha Khatri. Discussion: https://postgr.es/m/CAFO0U+-iOS5oYN5v3SBuZvfhPUTRrkDFEx8w7H17B07Rwg3YUA@mail.gmail.com
1 parent a71f101 commit 11324e4

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

src/backend/parser/gram.y

+2-16
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
513513
Bit ConstBit BitWithLength BitWithoutLength
514514
%type <str> character
515515
%type <str> extract_arg
516-
%type <str> opt_charset
517516
%type <boolean> opt_varying opt_timezone opt_no_inherit
518517

519518
%type <ival> Iconst SignedIconst
@@ -11923,28 +11922,20 @@ ConstCharacter: CharacterWithLength
1192311922
}
1192411923
;
1192511924

11926-
CharacterWithLength: character '(' Iconst ')' opt_charset
11925+
CharacterWithLength: character '(' Iconst ')'
1192711926
{
11928-
if (($5 != NULL) && (strcmp($5, "sql_text") != 0))
11929-
$1 = psprintf("%s_%s", $1, $5);
11930-
1193111927
$$ = SystemTypeName($1);
1193211928
$$->typmods = list_make1(makeIntConst($3, @3));
1193311929
$$->location = @1;
1193411930
}
1193511931
;
1193611932

11937-
CharacterWithoutLength: character opt_charset
11933+
CharacterWithoutLength: character
1193811934
{
11939-
if (($2 != NULL) && (strcmp($2, "sql_text") != 0))
11940-
$1 = psprintf("%s_%s", $1, $2);
11941-
1194211935
$$ = SystemTypeName($1);
11943-
1194411936
/* char defaults to char(1), varchar to no limit */
1194511937
if (strcmp($1, "bpchar") == 0)
1194611938
$$->typmods = list_make1(makeIntConst(1, -1));
11947-
1194811939
$$->location = @1;
1194911940
}
1195011941
;
@@ -11968,11 +11959,6 @@ opt_varying:
1196811959
| /*EMPTY*/ { $$ = FALSE; }
1196911960
;
1197011961

11971-
opt_charset:
11972-
CHARACTER SET ColId { $$ = $3; }
11973-
| /*EMPTY*/ { $$ = NULL; }
11974-
;
11975-
1197611962
/*
1197711963
* SQL date/time types
1197811964
*/

0 commit comments

Comments
 (0)