Commit 11324e40 authored by Tom Lane's avatar Tom Lane

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 f10b6392.
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
parent a71f1018
...@@ -513,7 +513,6 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query); ...@@ -513,7 +513,6 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
Bit ConstBit BitWithLength BitWithoutLength Bit ConstBit BitWithLength BitWithoutLength
%type <str> character %type <str> character
%type <str> extract_arg %type <str> extract_arg
%type <str> opt_charset
%type <boolean> opt_varying opt_timezone opt_no_inherit %type <boolean> opt_varying opt_timezone opt_no_inherit
%type <ival> Iconst SignedIconst %type <ival> Iconst SignedIconst
...@@ -11923,28 +11922,20 @@ ConstCharacter: CharacterWithLength ...@@ -11923,28 +11922,20 @@ ConstCharacter: CharacterWithLength
} }
; ;
CharacterWithLength: character '(' Iconst ')' opt_charset CharacterWithLength: character '(' Iconst ')'
{ {
if (($5 != NULL) && (strcmp($5, "sql_text") != 0))
$1 = psprintf("%s_%s", $1, $5);
$$ = SystemTypeName($1); $$ = SystemTypeName($1);
$$->typmods = list_make1(makeIntConst($3, @3)); $$->typmods = list_make1(makeIntConst($3, @3));
$$->location = @1; $$->location = @1;
} }
; ;
CharacterWithoutLength: character opt_charset CharacterWithoutLength: character
{ {
if (($2 != NULL) && (strcmp($2, "sql_text") != 0))
$1 = psprintf("%s_%s", $1, $2);
$$ = SystemTypeName($1); $$ = SystemTypeName($1);
/* char defaults to char(1), varchar to no limit */ /* char defaults to char(1), varchar to no limit */
if (strcmp($1, "bpchar") == 0) if (strcmp($1, "bpchar") == 0)
$$->typmods = list_make1(makeIntConst(1, -1)); $$->typmods = list_make1(makeIntConst(1, -1));
$$->location = @1; $$->location = @1;
} }
; ;
...@@ -11968,11 +11959,6 @@ opt_varying: ...@@ -11968,11 +11959,6 @@ opt_varying:
| /*EMPTY*/ { $$ = FALSE; } | /*EMPTY*/ { $$ = FALSE; }
; ;
opt_charset:
CHARACTER SET ColId { $$ = $3; }
| /*EMPTY*/ { $$ = NULL; }
;
/* /*
* SQL date/time types * SQL date/time types
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment