Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5d2d672

Browse files
committed
Handle truncate table and CREATE DOMAIN AS (temp)
1 parent 96222ee commit 5d2d672

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

contrib/mmts/multimaster.c

+40-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
#include "pglogical_output/hooks.h"
6363
#include "parser/analyze.h"
6464
#include "parser/parse_relation.h"
65+
#include "parser/parse_type.h"
66+
#include "catalog/pg_class.h"
67+
#include "catalog/pg_type.h"
6568
#include "tcop/pquery.h"
6669
#include "lib/ilist.h"
6770

@@ -3916,7 +3919,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
39163919
case T_DoStmt:
39173920
case T_CreateTableSpaceStmt:
39183921
case T_AlterTableSpaceOptionsStmt:
3919-
case T_TruncateStmt:
39203922
case T_CommentStmt:
39213923
case T_PrepareStmt:
39223924
case T_ExecuteStmt:
@@ -3935,6 +3937,43 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
39353937
skipCommand = true;
39363938
break;
39373939

3940+
case T_CreateDomainStmt:
3941+
{
3942+
CreateDomainStmt *stmt = (CreateDomainStmt *) parsetree;
3943+
HeapTuple typeTup;
3944+
Form_pg_type baseType;
3945+
Form_pg_type elementType;
3946+
Form_pg_class pgClassStruct;
3947+
int32 basetypeMod;
3948+
Oid elementTypeOid;
3949+
Oid tableOid;
3950+
HeapTuple pgClassTuple;
3951+
HeapTuple elementTypeTuple;
3952+
3953+
typeTup = typenameType(NULL, stmt->typeName, &basetypeMod);
3954+
baseType = (Form_pg_type) GETSTRUCT(typeTup);
3955+
elementTypeOid = baseType->typelem;
3956+
ReleaseSysCache(typeTup);
3957+
3958+
if (elementTypeOid == InvalidOid)
3959+
break;
3960+
3961+
elementTypeTuple = SearchSysCache1(TYPEOID, elementTypeOid);
3962+
elementType = (Form_pg_type) GETSTRUCT(elementTypeTuple);
3963+
tableOid = elementType->typrelid;
3964+
ReleaseSysCache(elementTypeTuple);
3965+
3966+
if (tableOid == InvalidOid)
3967+
break;
3968+
3969+
pgClassTuple = SearchSysCache1(RELOID, tableOid);
3970+
pgClassStruct = (Form_pg_class) GETSTRUCT(pgClassTuple);
3971+
if (pgClassStruct->relpersistence == 't')
3972+
MyXactAccessedTempRel = true;
3973+
ReleaseSysCache(pgClassTuple);
3974+
}
3975+
break;
3976+
39383977
case T_ExplainStmt:
39393978
/*
39403979
* EXPLAIN ANALYZE can create side-effects.

0 commit comments

Comments
 (0)