mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Allow SQL:2008 syntax ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE
alongside our traditional syntax.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.626 2008/10/20 14:26:28 petere Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.627 2008/10/21 08:38:15 petere Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -304,7 +304,7 @@ static TypeName *TableFuncTypeName(List *columns);
|
||||
|
||||
%type <boolean> copy_from
|
||||
|
||||
%type <ival> opt_column event cursor_options opt_hold
|
||||
%type <ival> opt_column event cursor_options opt_hold opt_set_data
|
||||
%type <objtype> reindex_type drop_type comment_type
|
||||
|
||||
%type <node> fetch_direction select_limit_value select_offset_value
|
||||
@@ -407,7 +407,7 @@ static TypeName *TableFuncTypeName(List *columns);
|
||||
CREATEROLE CREATEUSER CROSS CSV CTYPE CURRENT_P CURRENT_DATE CURRENT_ROLE
|
||||
CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE
|
||||
|
||||
DATABASE DAY_P DEALLOCATE DEC DECIMAL_P DECLARE DEFAULT DEFAULTS
|
||||
DATA_P DATABASE DAY_P DEALLOCATE DEC DECIMAL_P DECLARE DEFAULT DEFAULTS
|
||||
DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS DESC
|
||||
DICTIONARY DISABLE_P DISCARD DISTINCT DO DOCUMENT_P DOMAIN_P DOUBLE_P DROP
|
||||
|
||||
@@ -1534,16 +1534,16 @@ alter_table_cmd:
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
/*
|
||||
* ALTER TABLE <name> ALTER [COLUMN] <colname> TYPE <typename>
|
||||
* ALTER TABLE <name> ALTER [COLUMN] <colname> [SET DATA] TYPE <typename>
|
||||
* [ USING <expression> ]
|
||||
*/
|
||||
| ALTER opt_column ColId TYPE_P Typename alter_using
|
||||
| ALTER opt_column ColId opt_set_data TYPE_P Typename alter_using
|
||||
{
|
||||
AlterTableCmd *n = makeNode(AlterTableCmd);
|
||||
n->subtype = AT_AlterColumnType;
|
||||
n->name = $3;
|
||||
n->def = (Node *) $5;
|
||||
n->transform = $6;
|
||||
n->def = (Node *) $6;
|
||||
n->transform = $7;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
/* ALTER TABLE <name> ADD CONSTRAINT ... */
|
||||
@@ -4854,6 +4854,10 @@ opt_column: COLUMN { $$ = COLUMN; }
|
||||
| /*EMPTY*/ { $$ = 0; }
|
||||
;
|
||||
|
||||
opt_set_data: SET DATA_P { $$ = 1; }
|
||||
| /*EMPTY*/ { $$ = 0; }
|
||||
;
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ALTER THING name SET SCHEMA name
|
||||
@@ -9317,6 +9321,7 @@ unreserved_keyword:
|
||||
| CURRENT_P
|
||||
| CURSOR
|
||||
| CYCLE
|
||||
| DATA_P
|
||||
| DATABASE
|
||||
| DAY_P
|
||||
| DEALLOCATE
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.202 2008/10/04 21:56:54 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.203 2008/10/21 08:38:15 petere Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -123,6 +123,7 @@ const ScanKeyword ScanKeywords[] = {
|
||||
{"current_user", CURRENT_USER, RESERVED_KEYWORD},
|
||||
{"cursor", CURSOR, UNRESERVED_KEYWORD},
|
||||
{"cycle", CYCLE, UNRESERVED_KEYWORD},
|
||||
{"data", DATA_P, UNRESERVED_KEYWORD},
|
||||
{"database", DATABASE, UNRESERVED_KEYWORD},
|
||||
{"day", DAY_P, UNRESERVED_KEYWORD},
|
||||
{"deallocate", DEALLOCATE, UNRESERVED_KEYWORD},
|
||||
|
Reference in New Issue
Block a user