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

Commit3ee8067

Browse files
committed
Code review for ATExecAttachPartition.
Amit Langote. Most of this reported by Álvaro Herrera.
1 parentc444868 commit3ee8067

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12996,7 +12996,6 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
1299612996
*existConstraint;
1299712997
SysScanDescscan;
1299812998
ScanKeyDataskey;
12999-
HeapTupletuple;
1300012999
AttrNumberattno;
1300113000
intnatts;
1300213001
TupleDesctupleDesc;
@@ -13018,7 +13017,7 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
1301813017
errmsg("\"%s\" is already a partition",
1301913018
RelationGetRelationName(attachRel))));
1302013019

13021-
if (attachRel->rd_rel->reloftype)
13020+
if (OidIsValid(attachRel->rd_rel->reloftype))
1302213021
ereport(ERROR,
1302313022
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
1302413023
errmsg("cannot attach a typed table as partition")));
@@ -13119,9 +13118,10 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
1311913118
if (attribute->attisdropped)
1312013119
continue;
1312113120

13122-
/* Find same column in parent (matching on column name). */
13123-
tuple=SearchSysCacheCopyAttName(RelationGetRelid(rel),attributeName);
13124-
if (!HeapTupleIsValid(tuple))
13121+
/* Try to find the column in parent (matching on column name) */
13122+
if (!SearchSysCacheExists2(ATTNAME,
13123+
ObjectIdGetDatum(RelationGetRelid(rel)),
13124+
CStringGetDatum(attributeName)))
1312513125
ereport(ERROR,
1312613126
(errcode(ERRCODE_DATATYPE_MISMATCH),
1312713127
errmsg("table \"%s\" contains column \"%s\" not found in parent \"%s\"",
@@ -13167,7 +13167,6 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
1316713167
* There is a case in which we cannot rely on just the result of the
1316813168
* proof.
1316913169
*/
13170-
tupleDesc=RelationGetDescr(attachRel);
1317113170
attachRel_constr=tupleDesc->constr;
1317213171
existConstraint=NIL;
1317313172
if (attachRel_constr!=NULL)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp