option should not be null when modifying column

This commit is contained in:
wuyuechuan
2022-09-20 17:12:50 +08:00
parent 2d06f7d0d2
commit febbb15390
3 changed files with 20 additions and 4 deletions

View File

@ -3424,7 +3424,7 @@ modify_column_cmd:
$$ = (Node *)n;
}
/* modify column comments start */
| COLUMN ColId opt_column_options
| COLUMN ColId column_options
{
AlterTableCmd *n = makeNode(AlterTableCmd);
ColumnDef *def = makeNode(ColumnDef);
@ -3436,7 +3436,7 @@ modify_column_cmd:
$$ = (Node *)n;
}
;
| ColId opt_column_options
| ColId column_options
{
AlterTableCmd *n = makeNode(AlterTableCmd);
ColumnDef *def = makeNode(ColumnDef);

View File

@ -55,6 +55,16 @@ create database b_comments dbcompatibility 'B';
\c b_comments
create schema b_comments;
set search_path to 'b_comments';
/* unsupported */
create table test_unsupported(id int);
alter table test_unsupported modify column id;
ERROR: syntax error at or near ";"
LINE 1: alter table test_unsupported modify column id;
^
alter table test_unsupported modify id;
ERROR: syntax error at or near ";"
LINE 1: alter table test_unsupported modify id;
^
/* sanity check */
create table test_row(a int not null comment 'test_row.a', b int not null comment 'test_row.b') comment 'test_row';
create index on test_row(a,b) comment 'test_row_index';
@ -236,8 +246,9 @@ where pc.relname = 'uq_0034';
(1 row)
drop schema b_comments cascade;
NOTICE: drop cascades to 15 other objects
DETAIL: drop cascades to table test_row
NOTICE: drop cascades to 16 other objects
DETAIL: drop cascades to table test_unsupported
drop cascades to table test_row
drop cascades to table test_column
drop cascades to table test
drop cascades to table partition_test

View File

@ -38,6 +38,11 @@ create database b_comments dbcompatibility 'B';
\c b_comments
create schema b_comments;
set search_path to 'b_comments';
/* unsupported */
create table test_unsupported(id int);
alter table test_unsupported modify column id;
alter table test_unsupported modify id;
/* sanity check */
create table test_row(a int not null comment 'test_row.a', b int not null comment 'test_row.b') comment 'test_row';
create index on test_row(a,b) comment 'test_row_index';