mirror of
https://github.com/postgres/postgres.git
synced 2025-09-05 02:22:28 +03:00
Allow specifying STORAGE attribute for a new table
Previously, the STORAGE specification was only available in ALTER TABLE. This makes it available in CREATE TABLE as well. Also make the code and the documentation for STORAGE and COMPRESSION attributes consistent. Author: Teodor Sigaev <teodor@sigaev.ru> Author: Aleksander Alekseev <aleksander@timescale.com> Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Reviewed-by: wenjing zeng <wjzeng2012@gmail.com> Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/de83407a-ae3d-a8e1-a788-920eb334f25b@sigaev.ru
This commit is contained in:
@@ -595,7 +595,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
|
||||
|
||||
%type <node> TableConstraint TableLikeClause
|
||||
%type <ival> TableLikeOptionList TableLikeOption
|
||||
%type <str> column_compression opt_column_compression
|
||||
%type <str> column_compression opt_column_compression column_storage opt_column_storage
|
||||
%type <list> ColQualList
|
||||
%type <node> ColConstraint ColConstraintElem ConstraintAttr
|
||||
%type <ival> key_match
|
||||
@@ -2537,13 +2537,13 @@ alter_table_cmd:
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
/* ALTER TABLE <name> ALTER [COLUMN] <colname> SET STORAGE <storagemode> */
|
||||
| ALTER opt_column ColId SET STORAGE ColId
|
||||
| ALTER opt_column ColId SET column_storage
|
||||
{
|
||||
AlterTableCmd *n = makeNode(AlterTableCmd);
|
||||
|
||||
n->subtype = AT_SetStorage;
|
||||
n->name = $3;
|
||||
n->def = (Node *) makeString($6);
|
||||
n->def = (Node *) makeString($5);
|
||||
$$ = (Node *) n;
|
||||
}
|
||||
/* ALTER TABLE <name> ALTER [COLUMN] <colname> SET COMPRESSION <cm> */
|
||||
@@ -3778,13 +3778,14 @@ TypedTableElement:
|
||||
| TableConstraint { $$ = $1; }
|
||||
;
|
||||
|
||||
columnDef: ColId Typename opt_column_compression create_generic_options ColQualList
|
||||
columnDef: ColId Typename opt_column_storage opt_column_compression create_generic_options ColQualList
|
||||
{
|
||||
ColumnDef *n = makeNode(ColumnDef);
|
||||
|
||||
n->colname = $1;
|
||||
n->typeName = $2;
|
||||
n->compression = $3;
|
||||
n->storage_name = $3;
|
||||
n->compression = $4;
|
||||
n->inhcount = 0;
|
||||
n->is_local = true;
|
||||
n->is_not_null = false;
|
||||
@@ -3793,8 +3794,8 @@ columnDef: ColId Typename opt_column_compression create_generic_options ColQualL
|
||||
n->raw_default = NULL;
|
||||
n->cooked_default = NULL;
|
||||
n->collOid = InvalidOid;
|
||||
n->fdwoptions = $4;
|
||||
SplitColQualList($5, &n->constraints, &n->collClause,
|
||||
n->fdwoptions = $5;
|
||||
SplitColQualList($6, &n->constraints, &n->collClause,
|
||||
yyscanner);
|
||||
n->location = @1;
|
||||
$$ = (Node *) n;
|
||||
@@ -3851,6 +3852,15 @@ opt_column_compression:
|
||||
| /*EMPTY*/ { $$ = NULL; }
|
||||
;
|
||||
|
||||
column_storage:
|
||||
STORAGE ColId { $$ = $2; }
|
||||
;
|
||||
|
||||
opt_column_storage:
|
||||
column_storage { $$ = $1; }
|
||||
| /*EMPTY*/ { $$ = NULL; }
|
||||
;
|
||||
|
||||
ColQualList:
|
||||
ColQualList ColConstraint { $$ = lappend($1, $2); }
|
||||
| /*EMPTY*/ { $$ = NIL; }
|
||||
|
Reference in New Issue
Block a user