!2450 【I61RIM】修复未校验foreign table的自增列导致的core问题
Merge pull request !2450 from 李居东/issue_3.1.0
This commit is contained in:
@ -1285,6 +1285,12 @@ static void transformColumnDefinition(CreateStmtContext* cxt, ColumnDef* column,
|
||||
/* transformConstraintAttrs took care of these */
|
||||
break;
|
||||
case CONSTR_AUTO_INCREMENT:
|
||||
if (IsA(cxt->node, CreateForeignTableStmt) ||
|
||||
(cxt->rel != NULL && (IS_FOREIGNTABLE(cxt->rel) || IS_STREAM_TABLE(cxt->rel)))) {
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("Un-support feature"),
|
||||
errdetail("auto_increment column is not supported in foreign table")));
|
||||
}
|
||||
if (column->is_serial) {
|
||||
ereport(ERROR, (errcode(ERRCODE_OPERATE_NOT_SUPPORTED),
|
||||
errmsg("The datatype of column '%s' does not support auto_increment", column->colname)));
|
||||
|
||||
@ -96,6 +96,14 @@ DETAIL: Orientation type orc is not supported for auto_increment
|
||||
CREATE TABLE test_create_autoinc_err(id INTEGER auto_increment, name varchar(200),a int, primary key(id)) with (ORIENTATION=timeseries);
|
||||
ERROR: Un-supported feature
|
||||
DETAIL: Orientation type timeseries is not supported for auto_increment
|
||||
CREATE FOREIGN TABLE t_table_0020 (
|
||||
col01 integer AUTO_INCREMENT NOT NULL,
|
||||
col02 float,
|
||||
col03 int,
|
||||
PRIMARY KEY (col01,col02,col03)
|
||||
) server gsmpp_server;
|
||||
ERROR: Un-support feature
|
||||
DETAIL: auto_increment column is not supported in foreign table
|
||||
--test different type with auto_increment start value
|
||||
CREATE TABLE test_create_autoinc(id bool auto_increment primary key, name varchar(200),a int) auto_increment=1;
|
||||
NOTICE: CREATE TABLE will create implicit sequence "test_create_autoinc_id_seq" for serial column "test_create_autoinc.id"
|
||||
|
||||
@ -38,7 +38,12 @@ CREATE TABLE test_create_autoinc_err(id int16 auto_increment, name varchar(200),
|
||||
CREATE TABLE test_create_autoinc_err(id INTEGER auto_increment, name varchar(200),a int, primary key(id)) with (ORIENTATION=column);
|
||||
CREATE TABLE test_create_autoinc_err(id INTEGER auto_increment, name varchar(200),a int, primary key(id)) with (ORIENTATION=orc);
|
||||
CREATE TABLE test_create_autoinc_err(id INTEGER auto_increment, name varchar(200),a int, primary key(id)) with (ORIENTATION=timeseries);
|
||||
|
||||
CREATE FOREIGN TABLE t_table_0020 (
|
||||
col01 integer AUTO_INCREMENT NOT NULL,
|
||||
col02 float,
|
||||
col03 int,
|
||||
PRIMARY KEY (col01,col02,col03)
|
||||
) server gsmpp_server;
|
||||
--test different type with auto_increment start value
|
||||
CREATE TABLE test_create_autoinc(id bool auto_increment primary key, name varchar(200),a int) auto_increment=1;
|
||||
INSERT INTO test_create_autoinc VALUES(DEFAULT,'Gauss',0);
|
||||
|
||||
Reference in New Issue
Block a user