Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit91dbb86

Browse files
committed
Produce warning on creation table without primary key in multimaster
1 parent791692a commit91dbb86

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎contrib/mmts/multimaster.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include"access/htup_details.h"
6363
#include"catalog/indexing.h"
6464
#include"catalog/namespace.h"
65+
#include"catalog/pg_constraint_fn.h"
6566
#include"pglogical_output/hooks.h"
6667
#include"parser/analyze.h"
6768
#include"parser/parse_relation.h"
@@ -5179,6 +5180,23 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
51795180
{
51805181
MtmFinishDDLCommand();
51815182
}
5183+
if (nodeTag(parsetree)==T_CreateStmt)
5184+
{
5185+
CreateStmt*create= (CreateStmt*)parsetree;
5186+
Oidrelid=RangeVarGetRelid(create->relation,NoLock, true);
5187+
if (relid!=InvalidOid) {
5188+
Oidconstraint_oid;
5189+
Bitmapset*pk=get_primary_key_attnos(relid, true,&constraint_oid);
5190+
if (pk==NULL) {
5191+
elog(WARNING,
5192+
MtmIgnoreTablesWithoutPk
5193+
?"Table %s.%s without primary will not be replicated"
5194+
:"Updates and deletes of table %s.%s without primary will not be replicated",
5195+
create->relation->schemaname ?create->relation->schemaname :"public",
5196+
create->relation->relname);
5197+
}
5198+
}
5199+
}
51825200
}
51835201

51845202
staticvoid

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp