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

Commit9e943d0

Browse files
knizhnikkelvich
authored andcommitted
Produce warning on creation table without primary key in multimaster
1 parent46962bc commit9e943d0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎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"
@@ -5193,6 +5194,23 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
51935194
{
51945195
MtmFinishDDLCommand();
51955196
}
5197+
if (nodeTag(parsetree)==T_CreateStmt)
5198+
{
5199+
CreateStmt*create= (CreateStmt*)parsetree;
5200+
Oidrelid=RangeVarGetRelid(create->relation,NoLock, true);
5201+
if (relid!=InvalidOid) {
5202+
Oidconstraint_oid;
5203+
Bitmapset*pk=get_primary_key_attnos(relid, true,&constraint_oid);
5204+
if (pk==NULL) {
5205+
elog(WARNING,
5206+
MtmIgnoreTablesWithoutPk
5207+
?"Table %s.%s without primary will not be replicated"
5208+
:"Updates and deletes of table %s.%s without primary will not be replicated",
5209+
create->relation->schemaname ?create->relation->schemaname :"public",
5210+
create->relation->relname);
5211+
}
5212+
}
5213+
}
51965214
}
51975215

51985216
staticvoid

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp