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

Commit2e57875

Browse files
committed
Use format_type sibling in backend error messages, so the user sees
consistent type naming.
1 parent51e8dfd commit2e57875

File tree

16 files changed

+149
-106
lines changed

16 files changed

+149
-106
lines changed

‎src/backend/catalog/heap.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.171 2001/07/15 22:48:17 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.172 2001/08/09 18:28:16 petere Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -1668,12 +1668,12 @@ AddRelationRawConstraints(Relation rel,
16681668
{
16691669
if (CoerceTargetExpr(NULL,expr,type_id,
16701670
atp->atttypid,atp->atttypmod)==NULL)
1671-
elog(ERROR,"Attribute '%s' is of type'%s'"
1672-
" but default expression is of type'%s'"
1671+
elog(ERROR,"Column \"%s\" is of type%s"
1672+
" but default expression is of type%s"
16731673
"\n\tYou will need to rewrite or cast the expression",
16741674
NameStr(atp->attname),
1675-
typeidTypeName(atp->atttypid),
1676-
typeidTypeName(type_id));
1675+
format_type_be(atp->atttypid),
1676+
format_type_be(type_id));
16771677
}
16781678
}
16791679

‎src/backend/catalog/pg_proc.c

Lines changed: 12 additions & 12 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.55 2001/03/22 06:16:10 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.56 2001/08/09 18:28:17 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -343,7 +343,7 @@ checkretval(Oid rettype, List *queryTreeList)
343343
{
344344
if (rettype!=InvalidOid)
345345
elog(ERROR,"function declared to return %s, but no SELECT provided",
346-
typeidTypeName(rettype));
346+
format_type_be(rettype));
347347
return;
348348
}
349349

@@ -360,14 +360,14 @@ checkretval(Oid rettype, List *queryTreeList)
360360
if (rettype==InvalidOid)
361361
{
362362
if (cmd==CMD_SELECT)
363-
elog(ERROR,"function declared with no return type, but finalquery is a SELECT");
363+
elog(ERROR,"function declared with no return type, but finalstatement is a SELECT");
364364
return;
365365
}
366366

367367
/* by here, the function is declared to return some type */
368368
if (cmd!=CMD_SELECT)
369-
elog(ERROR,"function declared to return %s, but finalquery is not a SELECT",
370-
typeidTypeName(rettype));
369+
elog(ERROR,"function declared to return %s, but finalstatement is not a SELECT",
370+
format_type_be(rettype));
371371

372372
/*
373373
* Count the non-junk entries in the result targetlist.
@@ -383,12 +383,12 @@ checkretval(Oid rettype, List *queryTreeList)
383383
{
384384
if (tlistlen!=1)
385385
elog(ERROR,"function declared to return %s returns multiple columns in final SELECT",
386-
typeidTypeName(rettype));
386+
format_type_be(rettype));
387387

388388
resnode= (Resdom*) ((TargetEntry*)lfirst(tlist))->resdom;
389389
if (resnode->restype!=rettype)
390390
elog(ERROR,"return type mismatch in function: declared to return %s, returns %s",
391-
typeidTypeName(rettype),typeidTypeName(resnode->restype));
391+
format_type_be(rettype),format_type_be(resnode->restype));
392392

393393
return;
394394
}
@@ -419,7 +419,7 @@ checkretval(Oid rettype, List *queryTreeList)
419419

420420
if (tlistlen!=relnatts)
421421
elog(ERROR,"function declared to return %s does not SELECT the right number of columns (%d)",
422-
typeidTypeName(rettype),relnatts);
422+
format_type_be(rettype),relnatts);
423423

424424
/* expect attributes 1 .. n in order */
425425
i=0;
@@ -433,17 +433,17 @@ checkretval(Oid rettype, List *queryTreeList)
433433
tletype=exprType(tle->expr);
434434
if (tletype!=reln->rd_att->attrs[i]->atttypid)
435435
elog(ERROR,"function declared to return %s returns %s instead of %s at column %d",
436-
typeidTypeName(rettype),
437-
typeidTypeName(tletype),
438-
typeidTypeName(reln->rd_att->attrs[i]->atttypid),
436+
format_type_be(rettype),
437+
format_type_be(tletype),
438+
format_type_be(reln->rd_att->attrs[i]->atttypid),
439439
i+1);
440440
i++;
441441
}
442442

443443
/* this shouldn't happen, but let's just check... */
444444
if (i!=relnatts)
445445
elog(ERROR,"function declared to return %s does not SELECT the right number of columns (%d)",
446-
typeidTypeName(rettype),relnatts);
446+
format_type_be(rettype),relnatts);
447447

448448
heap_close(reln,AccessShareLock);
449449
}

‎src/backend/commands/indexcmds.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.54 2001/08/06 18:09:45 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.55 2001/08/09 18:28:17 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -403,8 +403,10 @@ GetAttrOpClass(IndexElem *attribute, Oid attrType,
403403
/* no operator class specified, so find the default */
404404
attribute->class=GetDefaultOpClass(attrType);
405405
if (attribute->class==NULL)
406-
elog(ERROR,"DefineIndex: type %s has no default operator class",
407-
typeidTypeName(attrType));
406+
elog(ERROR,"data type %s has no default operator class"
407+
"\n\tYou must specify an operator class for the index or define a"
408+
"\n\tdefault operator class for the data type",
409+
format_type_be(attrType));
408410
/* assume we need not check type compatibility */
409411
doTypeCheck= false;
410412
}
@@ -468,8 +470,8 @@ GetAttrOpClass(IndexElem *attribute, Oid attrType,
468470

469471
if (attrType!=opInputType&&
470472
!IS_BINARY_COMPATIBLE(attrType,opInputType))
471-
elog(ERROR,"DefineIndex: opclass \"%s\" does not acceptdatatype \"%s\"",
472-
attribute->class,typeidTypeName(attrType));
473+
elog(ERROR,"operator class \"%s\" does not acceptdata type %s",
474+
attribute->class,format_type_be(attrType));
473475
ReleaseSysCache(tuple);
474476
}
475477
}

‎src/backend/parser/parse_agg.c

Lines changed: 4 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/parser/parse_agg.c,v 1.44 2001/01/24 19:43:01 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.45 2001/08/09 18:28:17 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -22,6 +22,7 @@
2222
#include"parser/parse_expr.h"
2323
#include"parser/parsetree.h"
2424
#include"parser/parse_type.h"
25+
#include"utils/builtins.h"
2526
#include"utils/lsyscache.h"
2627
#include"utils/syscache.h"
2728

@@ -249,6 +250,6 @@ agg_error(char *caller, char *aggname, Oid basetypeID)
249250
elog(ERROR,"%s: aggregate '%s' for all types does not exist",
250251
caller,aggname);
251252
else
252-
elog(ERROR,"%s: aggregate '%s' for'%s' does not exist",
253-
caller,aggname,typeidTypeName(basetypeID));
253+
elog(ERROR,"%s: aggregate '%s' fortype %s does not exist",
254+
caller,aggname,format_type_be(basetypeID));
254255
}

‎src/backend/parser/parse_clause.c

Lines changed: 8 additions & 7 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_clause.c,v 1.81 2001/06/19 22:39:11 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.82 2001/08/09 18:28:17 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -29,6 +29,7 @@
2929
#include"parser/parse_relation.h"
3030
#include"parser/parse_target.h"
3131
#include"parser/parse_type.h"
32+
#include"utils/builtins.h"
3233
#include"utils/guc.h"
3334

3435

@@ -292,8 +293,8 @@ transformJoinUsingClause(ParseState *pstate, List *leftVars, List *rightVars)
292293
* "=" operator that doesn't return bool is wrong anyway.
293294
*/
294295
if (exprType(result)!=BOOLOID)
295-
elog(ERROR,"JOIN/USING clause must return typebool, not type %s",
296-
typeidTypeName(exprType(result)));
296+
elog(ERROR,"JOIN/USING clause must return typeboolean, not type %s",
297+
format_type_be(exprType(result)));
297298

298299
returnresult;
299300
}/* transformJoinUsingClause() */
@@ -328,8 +329,8 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j,
328329
result=transformExpr(pstate,j->quals,EXPR_COLUMN_FIRST);
329330

330331
if (!coerce_to_boolean(pstate,&result))
331-
elog(ERROR,"JOIN/ON clause must return typebool, not type %s",
332-
typeidTypeName(exprType(result)));
332+
elog(ERROR,"JOIN/ON clause must return typeboolean, not type %s",
333+
format_type_be(exprType(result)));
333334

334335
pstate->p_namespace=save_namespace;
335336

@@ -775,8 +776,8 @@ transformWhereClause(ParseState *pstate, Node *clause)
775776
qual=transformExpr(pstate,clause,EXPR_COLUMN_FIRST);
776777

777778
if (!coerce_to_boolean(pstate,&qual))
778-
elog(ERROR,"WHERE clause must return typebool, not type %s",
779-
typeidTypeName(exprType(qual)));
779+
elog(ERROR,"WHERE clause must return typeboolean, not type %s",
780+
format_type_be(exprType(qual)));
780781

781782
returnqual;
782783
}

‎src/backend/parser/parse_expr.c

Lines changed: 13 additions & 13 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.98 2001/06/19 22:39:11 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.99 2001/08/09 18:28:17 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -179,13 +179,13 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
179179

180180
if (!coerce_to_boolean(pstate,&lexpr))
181181
elog(ERROR,"left-hand side of AND is type '%s', not '%s'",
182-
typeidTypeName(exprType(lexpr)),
183-
typeidTypeName(BOOLOID));
182+
format_type_be(exprType(lexpr)),
183+
format_type_be(BOOLOID));
184184

185185
if (!coerce_to_boolean(pstate,&rexpr))
186186
elog(ERROR,"right-hand side of AND is type '%s', not '%s'",
187-
typeidTypeName(exprType(rexpr)),
188-
typeidTypeName(BOOLOID));
187+
format_type_be(exprType(rexpr)),
188+
format_type_be(BOOLOID));
189189

190190
expr->typeOid=BOOLOID;
191191
expr->opType=AND_EXPR;
@@ -205,13 +205,13 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
205205

206206
if (!coerce_to_boolean(pstate,&lexpr))
207207
elog(ERROR,"left-hand side of OR is type '%s', not '%s'",
208-
typeidTypeName(exprType(lexpr)),
209-
typeidTypeName(BOOLOID));
208+
format_type_be(exprType(lexpr)),
209+
format_type_be(BOOLOID));
210210

211211
if (!coerce_to_boolean(pstate,&rexpr))
212212
elog(ERROR,"right-hand side of OR is type '%s', not '%s'",
213-
typeidTypeName(exprType(rexpr)),
214-
typeidTypeName(BOOLOID));
213+
format_type_be(exprType(rexpr)),
214+
format_type_be(BOOLOID));
215215

216216
expr->typeOid=BOOLOID;
217217
expr->opType=OR_EXPR;
@@ -228,8 +228,8 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
228228

229229
if (!coerce_to_boolean(pstate,&rexpr))
230230
elog(ERROR,"argument to NOT is type '%s', not '%s'",
231-
typeidTypeName(exprType(rexpr)),
232-
typeidTypeName(BOOLOID));
231+
format_type_be(exprType(rexpr)),
232+
format_type_be(BOOLOID));
233233

234234
expr->typeOid=BOOLOID;
235235
expr->opType=NOT_EXPR;
@@ -962,8 +962,8 @@ parser_typecast_expression(ParseState *pstate,
962962
targetType,typename->typmod);
963963
if (expr==NULL)
964964
elog(ERROR,"Cannot cast type '%s' to '%s'",
965-
typeidTypeName(inputType),
966-
typeidTypeName(targetType));
965+
format_type_be(inputType),
966+
format_type_be(targetType));
967967
}
968968

969969
/*

‎src/backend/parser/parse_func.c

Lines changed: 4 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/parser/parse_func.c,v 1.109 2001/06/22 19:16:22 wieck Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.110 2001/08/09 18:28:18 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -29,6 +29,7 @@
2929
#include"parser/parse_func.h"
3030
#include"parser/parse_relation.h"
3131
#include"parser/parse_type.h"
32+
#include"utils/builtins.h"
3233
#include"utils/fmgroids.h"
3334
#include"utils/lsyscache.h"
3435
#include"utils/syscache.h"
@@ -288,7 +289,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
288289
{
289290
/* Multiple possible matches --- give up */
290291
elog(ERROR,"Unable to select an aggregate function %s(%s)",
291-
funcname,typeidTypeName(basetype));
292+
funcname,format_type_be(basetype));
292293
}
293294
}
294295

@@ -300,7 +301,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
300301
* function could not have been meant.
301302
*/
302303
elog(ERROR,"There is no aggregate function %s(%s)",
303-
funcname,typeidTypeName(basetype));
304+
funcname,format_type_be(basetype));
304305
}
305306
}
306307

‎src/backend/parser/parse_node.c

Lines changed: 3 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/parser/parse_node.c,v 1.54 2001/05/22 16:37:16 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.55 2001/08/09 18:28:18 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -373,8 +373,8 @@ transformArraySubscripts(ParseState *pstate,
373373
elog(ERROR,"Array assignment requires type '%s'"
374374
" but expression is of type '%s'"
375375
"\n\tYou will need to rewrite or cast the expression",
376-
typeidTypeName(typeneeded),
377-
typeidTypeName(typesource));
376+
format_type_be(typeneeded),
377+
format_type_be(typesource));
378378
}
379379
}
380380
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp