Remove vestigial grammar support for CHARACTER ... CHARACTER SET option.
authorTom Lane
Tue, 7 Mar 2017 15:42:11 +0000 (10:42 -0500)
committerTom Lane
Tue, 7 Mar 2017 15:42:18 +0000 (10:42 -0500)
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 f10b63923.
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

src/backend/parser/gram.y

index 083124ed3bef51c35a6f7d808d631faa6a852dab..bb55e1c95ccad9175aa07edf547597a73f550933 100644 (file)
@@ -513,7 +513,6 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
                Bit ConstBit BitWithLength BitWithoutLength
 %type         character
 %type         extract_arg
-%type         opt_charset
 %type  opt_varying opt_timezone opt_no_inherit
 
 %type    Iconst SignedIconst
@@ -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);
                    $$->typmods = list_make1(makeIntConst($3, @3));
                    $$->location = @1;
                }
        ;
 
-CharacterWithoutLength:     character opt_charset
+CharacterWithoutLength:     character
                {
-                   if (($2 != NULL) && (strcmp($2, "sql_text") != 0))
-                       $1 = psprintf("%s_%s", $1, $2);
-
                    $$ = SystemTypeName($1);
-
                    /* char defaults to char(1), varchar to no limit */
                    if (strcmp($1, "bpchar") == 0)
                        $$->typmods = list_make1(makeIntConst(1, -1));
-
                    $$->location = @1;
                }
        ;
@@ -11968,11 +11959,6 @@ opt_varying:
            | /*EMPTY*/                             { $$ = FALSE; }
        ;
 
-opt_charset:
-           CHARACTER SET ColId                     { $$ = $3; }
-           | /*EMPTY*/                             { $$ = NULL; }
-       ;
-
 /*
  * SQL date/time types
  */