namespace-check.diff
text/plain
Filename: namespace-check.diff
Type: text/plain
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/commands/tablecmds.c | 8 | 0 |
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0b2a52463f..a1937d078b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -20388,6 +20388,14 @@ createPartitionTable(RangeVar *newPartName, Relation modelRel,
*/
newRel = table_openrv(newPartName, NoLock);
+ /* Check for case namespace was renamed during partition creation. */
+ if (RelationGetNamespace(newRel) != RelationGetNamespace(modelRel))
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot create partition because namespace \"%s\" was changed to \"%s\"",
+ get_namespace_name(RelationGetNamespace(newRel)),
+ get_namespace_name(RelationGetNamespace(modelRel)))));
+
/*
* We intended to create the partition with the same persistence as the
* parent table, but we still need to recheck because that might be