!124 fix long regression temp table issue

Merge pull request !124 from wangzhijun/master
This commit is contained in:
opengauss-bot
2020-08-24 11:33:02 +08:00
committed by Gitee
3 changed files with 15 additions and 11 deletions

View File

@ -1699,12 +1699,9 @@ static Relation relation_build_desc(Oid targetRelId, bool insertIt, bool buildke
switch (relation->rd_rel->relpersistence) {
case RELPERSISTENCE_UNLOGGED:
case RELPERSISTENCE_PERMANENT:
relation->rd_backend = InvalidBackendId;
relation->rd_islocaltemp = false;
break;
case RELPERSISTENCE_TEMP: // @Temp Table. Temp table here is just like unlogged table.
relation->rd_backend = InvalidBackendId;
relation->rd_islocaltemp = true;
relation->rd_islocaltemp = false;
break;
case RELPERSISTENCE_GLOBAL_TEMP: // global temp table
{
@ -3712,12 +3709,9 @@ Relation RelationBuildLocalRelation(const char* relname, Oid relnamespace, Tuple
switch (relpersistence) {
case RELPERSISTENCE_UNLOGGED:
case RELPERSISTENCE_PERMANENT:
rel->rd_backend = InvalidBackendId;
rel->rd_islocaltemp = false;
break;
case RELPERSISTENCE_TEMP: // @Temp Table. Temp table here is just like unlogged table.
rel->rd_backend = InvalidBackendId;
rel->rd_islocaltemp = true;
rel->rd_islocaltemp = false;
break;
case RELPERSISTENCE_GLOBAL_TEMP: // global temp table
rel->rd_backend = BackendIdForTempRelations;

View File

@ -157,11 +157,15 @@ create global temp table gtt7 (like gtt2 including reloptions) on commit delete
create global temp table gtt8 on commit delete rows as select * from gtt3;
-- ok
select * into global temp table gtt9 from gtt2;
create global temp table gtt_test_rename(a int primary key, b text);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "gtt_test_rename_pkey" for table "gtt_test_rename"
create global temp table gtt_test_rename(a int, b text);
--ok
alter table gtt_test_rename rename to gtt_test_new;
--ok
alter table gtt_test_new add constraint pk1 primary key(a);
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "pk1" for table "gtt_test_new"
--ok
alter table gtt_test_new drop constraint pk1;
--ok
ALTER TABLE gtt_test_new ADD COLUMN address integer;
--ok
insert into gtt_test_new values(1, 'hello postgres', 128);

View File

@ -158,11 +158,17 @@ create global temp table gtt8 on commit delete rows as select * from gtt3;
-- ok
select * into global temp table gtt9 from gtt2;
create global temp table gtt_test_rename(a int primary key, b text);
create global temp table gtt_test_rename(a int, b text);
--ok
alter table gtt_test_rename rename to gtt_test_new;
--ok
alter table gtt_test_new add constraint pk1 primary key(a);
--ok
alter table gtt_test_new drop constraint pk1;
--ok
ALTER TABLE gtt_test_new ADD COLUMN address integer;