forked from huawei/openGauss-server
add orientation option restriction for global temp table
This commit is contained in:
parent
c83a927258
commit
047f400ddd
|
|
@ -686,6 +686,12 @@ static void CheckCStoreUnsupportedFeature(CreateStmt* stmt)
|
|||
{
|
||||
Assert(stmt);
|
||||
|
||||
if (stmt->relation->relpersistence == RELPERSISTENCE_GLOBAL_TEMP) {
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
|
||||
errmsg("global temporary table can only support heap table")));
|
||||
}
|
||||
|
||||
if (stmt->ofTypename) {
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
|
|
@ -15351,7 +15357,14 @@ void PreCommit_on_commit_actions(void)
|
|||
/* Do nothing (there shouldn't be such entries, actually) */
|
||||
break;
|
||||
case ONCOMMIT_DELETE_ROWS:
|
||||
oids_to_truncate = lappend_oid(oids_to_truncate, oc->relid);
|
||||
/*
|
||||
* If this transaction hasn't accessed any temporary
|
||||
* relations, we can skip truncating ON COMMIT DELETE ROWS
|
||||
* tables, as they must still be empty.
|
||||
*/
|
||||
if (t_thrd.xact_cxt.MyXactAccessedTempRel) {
|
||||
oids_to_truncate = lappend_oid(oids_to_truncate, oc->relid);
|
||||
}
|
||||
break;
|
||||
case ONCOMMIT_DROP: {
|
||||
ObjectAddress object;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ ERROR: must have at least one column
|
|||
alter table foo set (on_commit_delete_rows='true');
|
||||
ERROR: relation "foo" does not exist
|
||||
-- ERROR
|
||||
create global temp table cgtt(id int, b text) with (ORIENTATION=column);
|
||||
ERROR: global temporary table can only support heap table
|
||||
-- ERROR
|
||||
CREATE global temp TABLE measurement (
|
||||
logdate date not null,
|
||||
peaktemp int,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
set search_path=gtt,sys;
|
||||
analyze verify fast gtt1;
|
||||
select nextval('gtt_with_seq_c2_seq');
|
||||
nextval
|
||||
---------
|
||||
|
|
|
|||
|
|
@ -176,3 +176,10 @@ test: single_node_unsupported_view
|
|||
#test: hw_cstore
|
||||
|
||||
test: instr_unique_sql
|
||||
|
||||
# global temporary table tests
|
||||
test: gtt_stats
|
||||
test: gtt_function
|
||||
test: gtt_prepare
|
||||
test: gtt_parallel_1 gtt_parallel_2
|
||||
test: gtt_clean
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ create global temp table foo();
|
|||
-- ERROR
|
||||
alter table foo set (on_commit_delete_rows='true');
|
||||
|
||||
-- ERROR
|
||||
create global temp table cgtt(id int, b text) with (ORIENTATION=column);
|
||||
|
||||
-- ERROR
|
||||
CREATE global temp TABLE measurement (
|
||||
logdate date not null,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
set search_path=gtt,sys;
|
||||
|
||||
analyze verify fast gtt1;
|
||||
|
||||
select nextval('gtt_with_seq_c2_seq');
|
||||
|
||||
insert into gtt1 values(1, 'test1');
|
||||
|
|
|
|||
Loading…
Reference in New Issue