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

Commit22d641a

Browse files
committed
Get rid of the last few uses of typeidTypeName() rather than
format_type_be() in error messages.
1 parent940f772 commit22d641a

File tree

13 files changed

+73
-97
lines changed

13 files changed

+73
-97
lines changed

‎src/backend/catalog/pg_aggregate.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.44 2002/04/11 19:59:57 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.45 2002/05/17 22:35:12 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -24,7 +24,6 @@
2424
#include"optimizer/cost.h"
2525
#include"parser/parse_coerce.h"
2626
#include"parser/parse_func.h"
27-
#include"parser/parse_type.h"
2827
#include"utils/builtins.h"
2928
#include"utils/syscache.h"
3029

@@ -83,7 +82,7 @@ AggregateCreate(const char *aggName,
8382
proc= (Form_pg_proc)GETSTRUCT(tup);
8483
if (proc->prorettype!=aggTransType)
8584
elog(ERROR,"return type of transition function %s is not %s",
86-
NameListToString(aggtransfnName),typeidTypeName(aggTransType));
85+
NameListToString(aggtransfnName),format_type_be(aggTransType));
8786

8887
/*
8988
* If the transfn is strict and the initval is NULL, make sure input

‎src/backend/catalog/pg_proc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.70 2002/04/11 19:59:57 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.71 2002/05/17 22:35:12 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -140,7 +140,7 @@ ProcedureCreate(const char *procedureName,
140140
(relid=typeidTypeRelid(typev[0]))!=0&&
141141
get_attnum(relid, (char*)procedureName)!=InvalidAttrNumber)
142142
elog(ERROR,"method %s already an attribute of type %s",
143-
procedureName,typeidTypeName(typev[0]));
143+
procedureName,format_type_be(typev[0]));
144144

145145
/*
146146
* If this is a postquel procedure, we parse it here in order to be

‎src/backend/commands/tablecmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.13 2002/05/12 23:43:02 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.14 2002/05/17 22:35:12 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -548,7 +548,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
548548
elog(ERROR,"CREATE TABLE: inherited attribute \"%s\" type conflict (%s and %s)",
549549
attributeName,
550550
TypeNameToString(def->typename),
551-
typeidTypeName(attribute->atttypid));
551+
format_type_be(attribute->atttypid));
552552
/* Merge of NOT NULL constraints = OR 'em together */
553553
def->is_not_null |=attribute->attnotnull;
554554
/* Default and other constraints are handled below */

‎src/backend/executor/nodeAgg.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
* Portions Copyright (c) 1994, Regents of the University of California
4747
*
4848
* IDENTIFICATION
49-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.83 2002/04/29 22:28:19 tgl Exp $
49+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.84 2002/05/17 22:35:12 tgl Exp $
5050
*
5151
*-------------------------------------------------------------------------
5252
*/
@@ -63,7 +63,6 @@
6363
#include"parser/parse_coerce.h"
6464
#include"parser/parse_expr.h"
6565
#include"parser/parse_oper.h"
66-
#include"parser/parse_type.h"
6766
#include"utils/acl.h"
6867
#include"utils/builtins.h"
6968
#include"utils/lsyscache.h"
@@ -938,8 +937,8 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
938937
inputType,inputType,
939938
true);
940939
if (!OidIsValid(eq_function))
941-
elog(ERROR,"Unable to identify an equality operator for type'%s'",
942-
typeidTypeName(inputType));
940+
elog(ERROR,"Unable to identify an equality operator for type%s",
941+
format_type_be(inputType));
943942
fmgr_info(eq_function,&(peraggstate->equalfn));
944943
peraggstate->sortOperator=any_ordering_op(inputType);
945944
peraggstate->sortstate=NULL;

‎src/backend/executor/nodeGroup.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* locate group boundaries.
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.45 2002/04/16 23:08:10 tgl Exp $
18+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.46 2002/05/17 22:35:12 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -27,7 +27,7 @@
2727
#include"executor/executor.h"
2828
#include"executor/nodeGroup.h"
2929
#include"parser/parse_oper.h"
30-
#include"parser/parse_type.h"
30+
#include"utils/builtins.h"
3131
#include"utils/lsyscache.h"
3232
#include"utils/syscache.h"
3333

@@ -493,8 +493,8 @@ execTuplesMatchPrepare(TupleDesc tupdesc,
493493
eq_function=compatible_oper_funcid(makeList1(makeString("=")),
494494
typid,typid, true);
495495
if (!OidIsValid(eq_function))
496-
elog(ERROR,"Unable to identify an equality operator for type'%s'",
497-
typeidTypeName(typid));
496+
elog(ERROR,"Unable to identify an equality operator for type%s",
497+
format_type_be(typid));
498498
fmgr_info(eq_function,&eqfunctions[i]);
499499
}
500500

‎src/backend/optimizer/plan/initsplan.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.70 2002/05/12 23:43:03 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.71 2002/05/17 22:35:12 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -30,7 +30,7 @@
3030
#include"parser/parsetree.h"
3131
#include"parser/parse_expr.h"
3232
#include"parser/parse_oper.h"
33-
#include"parser/parse_type.h"
33+
#include"utils/builtins.h"
3434
#include"utils/lsyscache.h"
3535
#include"utils/syscache.h"
3636

@@ -748,7 +748,7 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
748748
* datatypes? NO, because sortkey selection may screw up anyway.
749749
*/
750750
elog(ERROR,"Unable to identify an equality operator for types '%s' and '%s'",
751-
typeidTypeName(ltype),typeidTypeName(rtype));
751+
format_type_be(ltype),format_type_be(rtype));
752752
}
753753
pgopform= (Form_pg_operator)GETSTRUCT(eq_operator);
754754

@@ -759,7 +759,7 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
759759
pgopform->oprrsortop!=sortop2||
760760
pgopform->oprresult!=BOOLOID)
761761
elog(ERROR,"Equality operator for types '%s' and '%s' should be mergejoinable, but isn't",
762-
typeidTypeName(ltype),typeidTypeName(rtype));
762+
format_type_be(ltype),format_type_be(rtype));
763763

764764
clause=makeNode(Expr);
765765
clause->typeOid=BOOLOID;

‎src/backend/parser/parse_coerce.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.72 2002/05/12 23:43:03 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.73 2002/05/17 22:35:12 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -133,7 +133,7 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
133133
InvalidOid,
134134
isExplicit);
135135
if (!OidIsValid(funcId))
136-
elog(ERROR,"coerce_type: no conversion function from%s to%s",
136+
elog(ERROR,"coerce_type: no conversion function from'%s' to'%s'",
137137
format_type_be(inputTypeId),format_type_be(targetTypeId));
138138

139139
result=build_func_call(funcId,baseTypeId,makeList1(node));
@@ -392,8 +392,8 @@ select_common_type(List *typeids, const char *context)
392392
* both types in different categories? then not much
393393
* hope...
394394
*/
395-
elog(ERROR,"%s types\"%s\" and\"%s\" not matched",
396-
context,typeidTypeName(ptype),typeidTypeName(ntype));
395+
elog(ERROR,"%s types'%s' and'%s' not matched",
396+
context,format_type_be(ptype),format_type_be(ntype));
397397
}
398398
elseif (IsPreferredType(pcategory,ntype)
399399
&& !IsPreferredType(pcategory,ptype)
@@ -448,8 +448,8 @@ coerce_to_common_type(ParseState *pstate, Node *node,
448448
false);
449449
else
450450
{
451-
elog(ERROR,"%s unable to convert to type\"%s\"",
452-
context,typeidTypeName(targetTypeId));
451+
elog(ERROR,"%s unable to convert to type%s",
452+
context,format_type_be(targetTypeId));
453453
}
454454
returnnode;
455455
}

‎src/backend/parser/parse_expr.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.117 2002/05/12 23:43:03 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.118 2002/05/17 22:35:13 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -366,7 +366,7 @@ transformExpr(ParseState *pstate, Node *expr)
366366
/* Combining operators other than =/<> is dubious... */
367367
if (length(left_list)!=1&&
368368
strcmp(opname,"=")!=0&&strcmp(opname,"<>")!=0)
369-
elog(ERROR,"Row comparison cannot use'%s'",
369+
elog(ERROR,"Row comparison cannot useoperator %s",
370370
opname);
371371

372372
/*
@@ -405,13 +405,13 @@ transformExpr(ParseState *pstate, Node *expr)
405405
opform= (Form_pg_operator)GETSTRUCT(optup);
406406

407407
if (opform->oprresult!=BOOLOID)
408-
elog(ERROR,"'%s'result type of'%s'must return'%s'"
408+
elog(ERROR,"%s hasresult type of%s, butmust return%s"
409409
" to be used with quantified predicate subquery",
410-
opname,typeidTypeName(opform->oprresult),
411-
typeidTypeName(BOOLOID));
410+
opname,format_type_be(opform->oprresult),
411+
format_type_be(BOOLOID));
412412

413413
if (get_func_retset(opform->oprcode))
414-
elog(ERROR,"'%s' must not return a set"
414+
elog(ERROR,"%s must not return a set"
415415
" to be used with quantified predicate subquery",
416416
opname);
417417

‎src/backend/parser/parse_func.c

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.129 2002/05/12 23:43:03 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.130 2002/05/17 22:35:13 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -19,6 +19,7 @@
1919
#include"catalog/namespace.h"
2020
#include"catalog/pg_inherits.h"
2121
#include"catalog/pg_proc.h"
22+
#include"lib/stringinfo.h"
2223
#include"nodes/makefuncs.h"
2324
#include"parser/parse_coerce.h"
2425
#include"parser/parse_expr.h"
@@ -261,9 +262,25 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
261262
* give an error message that is appropriate for that case.
262263
*/
263264
if (is_column)
264-
elog(ERROR,"Attribute \"%s\" not found",
265-
strVal(lfirst(funcname)));
266-
/* Else generate a detailed complaint */
265+
{
266+
char*colname=strVal(lfirst(funcname));
267+
OidrelTypeId;
268+
269+
Assert(nargs==1);
270+
if (IsA(first_arg,RangeVar))
271+
elog(ERROR,"No such attribute %s.%s",
272+
((RangeVar*)first_arg)->relname,colname);
273+
relTypeId=exprType(first_arg);
274+
if (!ISCOMPLEX(relTypeId))
275+
elog(ERROR,"Attribute notation .%s applied to type %s, which is not a complex type",
276+
colname,format_type_be(relTypeId));
277+
else
278+
elog(ERROR,"Attribute \"%s\" not found in datatype %s",
279+
colname,format_type_be(relTypeId));
280+
}
281+
/*
282+
* Else generate a detailed complaint for a function
283+
*/
267284
func_error(NULL,funcname,nargs,oid_array,
268285
"Unable to identify a function that satisfies the "
269286
"given argument types"
@@ -1214,39 +1231,31 @@ func_error(const char *caller, List *funcname,
12141231
intnargs,constOid*argtypes,
12151232
constchar*msg)
12161233
{
1217-
charp[(NAMEDATALEN+2)*FUNC_MAX_ARGS],
1218-
*ptr;
1234+
StringInfoDataargbuf;
12191235
inti;
12201236

1221-
ptr=p;
1222-
*ptr='\0';
1237+
initStringInfo(&argbuf);
1238+
12231239
for (i=0;i<nargs;i++)
12241240
{
12251241
if (i)
1226-
{
1227-
*ptr++=',';
1228-
*ptr++=' ';
1229-
}
1242+
appendStringInfo(&argbuf,", ");
12301243
if (OidIsValid(argtypes[i]))
1231-
{
1232-
strncpy(ptr,typeidTypeName(argtypes[i]),NAMEDATALEN);
1233-
*(ptr+NAMEDATALEN)='\0';
1234-
}
1244+
appendStringInfo(&argbuf,format_type_be(argtypes[i]));
12351245
else
1236-
strcpy(ptr,"opaque");
1237-
ptr+=strlen(ptr);
1246+
appendStringInfo(&argbuf,"opaque");
12381247
}
12391248

12401249
if (caller==NULL)
12411250
{
1242-
elog(ERROR,"Function'%s(%s)' does not exist%s%s",
1243-
NameListToString(funcname),p,
1251+
elog(ERROR,"Function %s(%s) does not exist%s%s",
1252+
NameListToString(funcname),argbuf.data,
12441253
((msg!=NULL) ?"\n\t" :""), ((msg!=NULL) ?msg :""));
12451254
}
12461255
else
12471256
{
1248-
elog(ERROR,"%s: function'%s(%s)' does not exist%s%s",
1249-
caller,NameListToString(funcname),p,
1257+
elog(ERROR,"%s: function %s(%s) does not exist%s%s",
1258+
caller,NameListToString(funcname),argbuf.data,
12501259
((msg!=NULL) ?"\n\t" :""), ((msg!=NULL) ?msg :""));
12511260
}
12521261
}
@@ -1271,10 +1280,10 @@ find_aggregate_func(const char *caller, List *aggname, Oid basetype)
12711280
if (!OidIsValid(oid))
12721281
{
12731282
if (basetype==InvalidOid)
1274-
elog(ERROR,"%s: aggregate'%s' for all types does not exist",
1283+
elog(ERROR,"%s: aggregate%s(*) does not exist",
12751284
caller,NameListToString(aggname));
12761285
else
1277-
elog(ERROR,"%s: aggregate'%s' for type %s does not exist",
1286+
elog(ERROR,"%s: aggregate%s(%s) does not exist",
12781287
caller,NameListToString(aggname),
12791288
format_type_be(basetype));
12801289
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp