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

Commitfe66125

Browse files
committed
Remove 'msg' parameter from convert_tuples_by_name
The message was included as a parameter when this function was added indcb2bda, but I don't think it has ever served any useful purpose.Let's stop spreading it pointlessly.Reviewed by Amit Langote and Peter Eisentraut.Discussion:https://postgr.es/m/20190806224728.GA17233@alvherre.pgsql
1 parent10f5544 commitfe66125

File tree

10 files changed

+33
-63
lines changed

10 files changed

+33
-63
lines changed

‎src/backend/access/common/tupconvert.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,14 @@ convert_tuples_by_position(TupleDesc indesc,
203203
*/
204204
TupleConversionMap*
205205
convert_tuples_by_name(TupleDescindesc,
206-
TupleDescoutdesc,
207-
constchar*msg)
206+
TupleDescoutdesc)
208207
{
209208
TupleConversionMap*map;
210209
AttrNumber*attrMap;
211210
intn=outdesc->natts;
212211

213212
/* Verify compatibility and prepare attribute-number map */
214-
attrMap=convert_tuples_by_name_map_if_req(indesc,outdesc,msg);
213+
attrMap=convert_tuples_by_name_map_if_req(indesc,outdesc);
215214

216215
if (attrMap==NULL)
217216
{
@@ -244,8 +243,7 @@ convert_tuples_by_name(TupleDesc indesc,
244243
*/
245244
AttrNumber*
246245
convert_tuples_by_name_map(TupleDescindesc,
247-
TupleDescoutdesc,
248-
constchar*msg)
246+
TupleDescoutdesc)
249247
{
250248
AttrNumber*attrMap;
251249
intoutnatts;
@@ -299,7 +297,7 @@ convert_tuples_by_name_map(TupleDesc indesc,
299297
if (atttypid!=inatt->atttypid||atttypmod!=inatt->atttypmod)
300298
ereport(ERROR,
301299
(errcode(ERRCODE_DATATYPE_MISMATCH),
302-
errmsg_internal("%s",_(msg)),
300+
errmsg("could not convert row type"),
303301
errdetail("Attribute \"%s\" of type %s does not match corresponding attribute of type %s.",
304302
attname,
305303
format_type_be(outdesc->tdtypeid),
@@ -311,7 +309,7 @@ convert_tuples_by_name_map(TupleDesc indesc,
311309
if (attrMap[i]==0)
312310
ereport(ERROR,
313311
(errcode(ERRCODE_DATATYPE_MISMATCH),
314-
errmsg_internal("%s",_(msg)),
312+
errmsg("could not convert row type"),
315313
errdetail("Attribute \"%s\" of type %s does not exist in type %s.",
316314
attname,
317315
format_type_be(outdesc->tdtypeid),
@@ -327,16 +325,15 @@ convert_tuples_by_name_map(TupleDesc indesc,
327325
*/
328326
AttrNumber*
329327
convert_tuples_by_name_map_if_req(TupleDescindesc,
330-
TupleDescoutdesc,
331-
constchar*msg)
328+
TupleDescoutdesc)
332329
{
333330
AttrNumber*attrMap;
334331
intn=outdesc->natts;
335332
inti;
336333
boolsame;
337334

338335
/* Verify compatibility and prepare attribute-number map */
339-
attrMap=convert_tuples_by_name_map(indesc,outdesc,msg);
336+
attrMap=convert_tuples_by_name_map(indesc,outdesc);
340337

341338
/*
342339
* Check to see if the map is one-to-one, in which case we need not do a

‎src/backend/catalog/partition.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ map_partition_varattnos(List *expr, int fromrel_varno,
210210
AttrNumber*part_attnos;
211211

212212
part_attnos=convert_tuples_by_name_map(RelationGetDescr(to_rel),
213-
RelationGetDescr(from_rel),
214-
gettext_noop("could not convert row type"));
213+
RelationGetDescr(from_rel));
215214
expr= (List*)map_variable_attnos((Node*)expr,
216215
fromrel_varno,0,
217216
part_attnos,

‎src/backend/commands/analyze.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,8 +1356,7 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
13561356
TupleConversionMap*map;
13571357

13581358
map=convert_tuples_by_name(RelationGetDescr(childrel),
1359-
RelationGetDescr(onerel),
1360-
gettext_noop("could not convert row type"));
1359+
RelationGetDescr(onerel));
13611360
if (map!=NULL)
13621361
{
13631362
intj;

‎src/backend/commands/indexcmds.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,8 +1086,7 @@ DefineIndex(Oid relationId,
10861086
childidxs=RelationGetIndexList(childrel);
10871087
attmap=
10881088
convert_tuples_by_name_map(RelationGetDescr(childrel),
1089-
parentDesc,
1090-
gettext_noop("could not convert row type"));
1089+
parentDesc);
10911090
maplen=parentDesc->natts;
10921091

10931092
foreach(cell,childidxs)

‎src/backend/commands/tablecmds.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,8 +1087,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
10871087
}
10881088

10891089
attmap = convert_tuples_by_name_map(RelationGetDescr(rel),
1090-
RelationGetDescr(parent),
1091-
gettext_noop("could not convert row type"));
1090+
RelationGetDescr(parent));
10921091
idxstmt =
10931092
generateClonedIndexStmt(NULL, idxRel,
10941093
attmap, RelationGetDescr(rel)->natts,
@@ -8171,8 +8170,7 @@ addFkRecurseReferenced(List **wqueue, Constraint *fkconstraint, Relation rel,
81718170
* definition to match the partition's column layout.
81728171
*/
81738172
map = convert_tuples_by_name_map_if_req(RelationGetDescr(partRel),
8174-
RelationGetDescr(pkrel),
8175-
gettext_noop("could not convert row type"));
8173+
RelationGetDescr(pkrel));
81768174
if (map)
81778175
{
81788176
mapped_pkattnum = palloc(sizeof(AttrNumber) * numfks);
@@ -8314,8 +8312,7 @@ addFkRecurseReferencing(List **wqueue, Constraint *fkconstraint, Relation rel,
83148312
CheckTableNotInUse(partition, "ALTER TABLE");
83158313

83168314
attmap = convert_tuples_by_name_map(RelationGetDescr(partition),
8317-
RelationGetDescr(rel),
8318-
gettext_noop("could not convert row type"));
8315+
RelationGetDescr(rel));
83198316
for (int j = 0; j < numfks; j++)
83208317
mapped_fkattnum[j] = attmap[fkattnum[j] - 1];
83218318

@@ -8505,8 +8502,7 @@ CloneFkReferenced(Relation parentRel, Relation partitionRel)
85058502
table_close(pg_constraint, RowShareLock);
85068503

85078504
attmap = convert_tuples_by_name_map(RelationGetDescr(partitionRel),
8508-
RelationGetDescr(parentRel),
8509-
gettext_noop("could not convert row type"));
8505+
RelationGetDescr(parentRel));
85108506
foreach(cell, clone)
85118507
{
85128508
OidconstrOid = lfirst_oid(cell);
@@ -8642,8 +8638,7 @@ CloneFkReferencing(List **wqueue, Relation parentRel, Relation partRel)
86428638
* different. This map is used to convert them.
86438639
*/
86448640
attmap = convert_tuples_by_name_map(RelationGetDescr(partRel),
8645-
RelationGetDescr(parentRel),
8646-
gettext_noop("could not convert row type"));
8641+
RelationGetDescr(parentRel));
86478642

86488643
partFKs = copyObject(RelationGetFKeyList(partRel));
86498644

@@ -10473,8 +10468,7 @@ ATPrepAlterColumnType(List **wqueue,
1047310468
cmd = copyObject(cmd);
1047410469

1047510470
attmap = convert_tuples_by_name_map(RelationGetDescr(childrel),
10476-
RelationGetDescr(rel),
10477-
gettext_noop("could not convert row type"));
10471+
RelationGetDescr(rel));
1047810472
((ColumnDef *) cmd->def)->cooked_default =
1047910473
map_variable_attnos(def->cooked_default,
1048010474
1, 0,
@@ -15845,8 +15839,7 @@ AttachPartitionEnsureIndexes(Relation rel, Relation attachrel)
1584515839
/* construct an indexinfo to compare existing indexes against */
1584615840
info = BuildIndexInfo(idxRel);
1584715841
attmap = convert_tuples_by_name_map(RelationGetDescr(attachrel),
15848-
RelationGetDescr(rel),
15849-
gettext_noop("could not convert row type"));
15842+
RelationGetDescr(rel));
1585015843
constraintOid = get_relation_idx_constraint_oid(RelationGetRelid(rel), idx);
1585115844

1585215845
/*
@@ -16422,8 +16415,7 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
1642216415
childInfo = BuildIndexInfo(partIdx);
1642316416
parentInfo = BuildIndexInfo(parentIdx);
1642416417
attmap = convert_tuples_by_name_map(RelationGetDescr(partTbl),
16425-
RelationGetDescr(parentTbl),
16426-
gettext_noop("could not convert row type"));
16418+
RelationGetDescr(parentTbl));
1642716419
if (!CompareIndexInfo(childInfo, parentInfo,
1642816420
partIdx->rd_indcollation,
1642916421
parentIdx->rd_indcollation,

‎src/backend/executor/execExprInterp.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3299,9 +3299,7 @@ ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op, ExprContext *econtext
32993299
old_cxt=MemoryContextSwitchTo(econtext->ecxt_per_query_memory);
33003300

33013301
/* prepare map from old to new attribute numbers */
3302-
op->d.convert_rowtype.map=
3303-
convert_tuples_by_name(indesc,outdesc,
3304-
gettext_noop("could not convert row type"));
3302+
op->d.convert_rowtype.map=convert_tuples_by_name(indesc,outdesc);
33053303
op->d.convert_rowtype.initialized= true;
33063304

33073305
MemoryContextSwitchTo(old_cxt);

‎src/backend/executor/execMain.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,8 +1861,7 @@ ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo,
18611861

18621862
old_tupdesc=RelationGetDescr(resultRelInfo->ri_RelationDesc);
18631863
/* a reverse map */
1864-
map=convert_tuples_by_name_map_if_req(old_tupdesc,tupdesc,
1865-
gettext_noop("could not convert row type"));
1864+
map=convert_tuples_by_name_map_if_req(old_tupdesc,tupdesc);
18661865

18671866
/*
18681867
* Partition-specific slot's tupdesc can't be changed, so allocate a
@@ -1947,8 +1946,7 @@ ExecConstraints(ResultRelInfo *resultRelInfo,
19471946
tupdesc=RelationGetDescr(rel);
19481947
/* a reverse map */
19491948
map=convert_tuples_by_name_map_if_req(orig_tupdesc,
1950-
tupdesc,
1951-
gettext_noop("could not convert row type"));
1949+
tupdesc);
19521950

19531951
/*
19541952
* Partition-specific slot's tupdesc can't be changed, so
@@ -1997,8 +1995,7 @@ ExecConstraints(ResultRelInfo *resultRelInfo,
19971995
tupdesc=RelationGetDescr(rel);
19981996
/* a reverse map */
19991997
map=convert_tuples_by_name_map_if_req(old_tupdesc,
2000-
tupdesc,
2001-
gettext_noop("could not convert row type"));
1998+
tupdesc);
20021999

20032000
/*
20042001
* Partition-specific slot's tupdesc can't be changed, so
@@ -2105,8 +2102,7 @@ ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo,
21052102
tupdesc=RelationGetDescr(rel);
21062103
/* a reverse map */
21072104
map=convert_tuples_by_name_map_if_req(old_tupdesc,
2108-
tupdesc,
2109-
gettext_noop("could not convert row type"));
2105+
tupdesc);
21102106

21112107
/*
21122108
* Partition-specific slot's tupdesc can't be changed,

‎src/backend/executor/execPartition.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,7 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate,
586586
*/
587587
part_attnos=
588588
convert_tuples_by_name_map(RelationGetDescr(partrel),
589-
RelationGetDescr(firstResultRel),
590-
gettext_noop("could not convert row type"));
589+
RelationGetDescr(firstResultRel));
591590
wcoList= (List*)
592591
map_variable_attnos((Node*)wcoList,
593592
firstVarno,0,
@@ -646,8 +645,7 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate,
646645
if (part_attnos==NULL)
647646
part_attnos=
648647
convert_tuples_by_name_map(RelationGetDescr(partrel),
649-
RelationGetDescr(firstResultRel),
650-
gettext_noop("could not convert row type"));
648+
RelationGetDescr(firstResultRel));
651649
returningList= (List*)
652650
map_variable_attnos((Node*)returningList,
653651
firstVarno,0,
@@ -790,8 +788,7 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate,
790788
if (part_attnos==NULL)
791789
part_attnos=
792790
convert_tuples_by_name_map(RelationGetDescr(partrel),
793-
RelationGetDescr(firstResultRel),
794-
gettext_noop("could not convert row type"));
791+
RelationGetDescr(firstResultRel));
795792
onconflset= (List*)
796793
map_variable_attnos((Node*)onconflset,
797794
INNER_VAR,0,
@@ -904,8 +901,7 @@ ExecInitRoutingInfo(ModifyTableState *mtstate,
904901
*/
905902
partrouteinfo->pi_RootToPartitionMap=
906903
convert_tuples_by_name(RelationGetDescr(partRelInfo->ri_PartitionRoot),
907-
RelationGetDescr(partRelInfo->ri_RelationDesc),
908-
gettext_noop("could not convert row type"));
904+
RelationGetDescr(partRelInfo->ri_RelationDesc));
909905

910906
/*
911907
* If a partition has a different rowtype than the root parent, initialize
@@ -937,8 +933,7 @@ ExecInitRoutingInfo(ModifyTableState *mtstate,
937933
{
938934
partrouteinfo->pi_PartitionToRootMap=
939935
convert_tuples_by_name(RelationGetDescr(partRelInfo->ri_RelationDesc),
940-
RelationGetDescr(partRelInfo->ri_PartitionRoot),
941-
gettext_noop("could not convert row type"));
936+
RelationGetDescr(partRelInfo->ri_PartitionRoot));
942937
}
943938
else
944939
partrouteinfo->pi_PartitionToRootMap=NULL;
@@ -1042,8 +1037,7 @@ ExecInitPartitionDispatchInfo(EState *estate,
10421037
* routing.
10431038
*/
10441039
pd->tupmap=convert_tuples_by_name_map_if_req(RelationGetDescr(parent_pd->reldesc),
1045-
tupdesc,
1046-
gettext_noop("could not convert row type"));
1040+
tupdesc);
10471041
pd->tupslot=pd->tupmap ?
10481042
MakeSingleTupleTableSlot(tupdesc,&TTSOpsVirtual) :NULL;
10491043
}

‎src/backend/executor/nodeModifyTable.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,8 +1959,7 @@ ExecSetupChildParentMapForSubplan(ModifyTableState *mtstate)
19591959
{
19601960
mtstate->mt_per_subplan_tupconv_maps[i]=
19611961
convert_tuples_by_name(RelationGetDescr(resultRelInfos[i].ri_RelationDesc),
1962-
outdesc,
1963-
gettext_noop("could not convert row type"));
1962+
outdesc);
19641963
}
19651964
}
19661965

‎src/include/access/tupconvert.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,12 @@ extern TupleConversionMap *convert_tuples_by_position(TupleDesc indesc,
3636
constchar*msg);
3737

3838
externTupleConversionMap*convert_tuples_by_name(TupleDescindesc,
39-
TupleDescoutdesc,
40-
constchar*msg);
39+
TupleDescoutdesc);
4140

4241
externAttrNumber*convert_tuples_by_name_map(TupleDescindesc,
43-
TupleDescoutdesc,
44-
constchar*msg);
42+
TupleDescoutdesc);
4543
externAttrNumber*convert_tuples_by_name_map_if_req(TupleDescindesc,
46-
TupleDescoutdesc,
47-
constchar*msg);
44+
TupleDescoutdesc);
4845

4946
externHeapTupleexecute_attr_map_tuple(HeapTupletuple,TupleConversionMap*map);
5047
externTupleTableSlot*execute_attr_map_slot(AttrNumber*attrMap,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp