Skip to content

Commit 294a2db

Browse files
committed
Handle truncate table and CREATE DOMAIN AS (temp)
1 parent 824cbc3 commit 294a2db

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

multimaster.c

Lines changed: 40 additions & 1 deletion
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

@@ -3915,7 +3918,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
39153918
case T_DoStmt:
39163919
case T_CreateTableSpaceStmt:
39173920
case T_AlterTableSpaceOptionsStmt:
3918-
case T_TruncateStmt:
39193921
case T_CommentStmt:
39203922
case T_PrepareStmt:
39213923
case T_ExecuteStmt:
@@ -3934,6 +3936,43 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
39343936
skipCommand = true;
39353937
break;
39363938

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy