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

Commitc72839d

Browse files
committed
Error message editing in backend/bootstrap, /lib, /nodes, /port.
1 parent56f8768 commitc72839d

File tree

21 files changed

+121
-113
lines changed

21 files changed

+121
-113
lines changed

‎src/backend/bootstrap/bootparse.y

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.58 2003/05/28 16:03:55 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.59 2003/07/22 23:30:37 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -155,7 +155,7 @@ Boot_CreateStmt:
155155
{
156156
do_start();
157157
numattr =0;
158-
elog(DEBUG4,"creating%s%s relation %s...",
158+
elog(DEBUG4,"creating%s%s relation %s",
159159
$2 ?" bootstrap" :"",
160160
$3 ?" shared" :"",
161161
LexIDStr($5));
@@ -210,9 +210,9 @@ Boot_InsertStmt:
210210
{
211211
do_start();
212212
if ($2)
213-
elog(DEBUG4,"inserting row with oid %u...", $2);
213+
elog(DEBUG4,"inserting row with oid %u", $2);
214214
else
215-
elog(DEBUG4,"inserting row...");
215+
elog(DEBUG4,"inserting row");
216216
num_columns_read =0;
217217
}
218218
LPAREN boot_tuplelist RPAREN
@@ -302,7 +302,7 @@ boot_typelist:
302302
boot_type_thing:
303303
boot_ident EQUALS boot_ident
304304
{
305-
if(++numattr > MAXATTR)
305+
if(++numattr > MAXATTR)
306306
elog(FATAL,"too many columns");
307307
DefineAttr(LexIDStr($1),LexIDStr($3),numattr-1);
308308
}

‎src/backend/bootstrap/bootscanner.l

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.28 2003/05/29 22:30:01 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootscanner.l,v 1.29 2003/07/22 23:30:37 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -129,7 +129,7 @@ insert{ return(INSERT_TUPLE); }
129129
}
130130

131131
.{
132-
elog(ERROR,"syntax error at line %d: unexpected character%s", yyline, yytext);
132+
elog(ERROR,"syntax error at line %d: unexpected character\"%s\"", yyline, yytext);
133133
}
134134

135135

@@ -139,5 +139,5 @@ insert{ return(INSERT_TUPLE); }
139139
void
140140
yyerror(constchar *str)
141141
{
142-
elog(ERROR,"syntax error at line %d: unexpected token%s", yyline, str);
142+
elog(ERROR,"syntax error at line %d: unexpected token\"%s\"", yyline, str);
143143
}

‎src/backend/bootstrap/bootstrap.c

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.161 2003/07/15 00:11:13 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.162 2003/07/22 23:30:37 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -314,9 +314,15 @@ BootstrapMain(int argc, char *argv[])
314314
if (!value)
315315
{
316316
if (flag=='-')
317-
elog(ERROR,"--%s requires argument",optarg);
317+
ereport(ERROR,
318+
(errcode(ERRCODE_SYNTAX_ERROR),
319+
errmsg("--%s requires a value",
320+
optarg)));
318321
else
319-
elog(ERROR,"-c %s requires argument",optarg);
322+
ereport(ERROR,
323+
(errcode(ERRCODE_SYNTAX_ERROR),
324+
errmsg("-c %s requires a value",
325+
optarg)));
320326
}
321327

322328
SetConfigOption(name,value,PGC_POSTMASTER,PGC_S_ARGV);
@@ -455,7 +461,7 @@ BootstrapMain(int argc, char *argv[])
455461
proc_exit(0);/* done */
456462

457463
default:
458-
elog(PANIC,"Unsupported XLOG op %d",xlogop);
464+
elog(PANIC,"unrecognized XLOG op: %d",xlogop);
459465
proc_exit(0);
460466
}
461467

@@ -566,7 +572,8 @@ boot_openrel(char *relname)
566572
if (boot_reldesc!=NULL)
567573
closerel(NULL);
568574

569-
elog(DEBUG4,"open relation %s, attrsize %d",relname ?relname :"(null)",
575+
elog(DEBUG4,"open relation %s, attrsize %d",
576+
relname ?relname :"(null)",
570577
(int)ATTRIBUTE_TUPLE_SIZE);
571578

572579
boot_reldesc=heap_openr(relname,NoLock);
@@ -601,11 +608,11 @@ closerel(char *name)
601608
if (boot_reldesc)
602609
{
603610
if (strcmp(RelationGetRelationName(boot_reldesc),name)!=0)
604-
elog(ERROR,"closerel:close of'%s' when'%s' was expected",
611+
elog(ERROR,"close of%s when%s was expected",
605612
name,relname ?relname :"(null)");
606613
}
607614
else
608-
elog(ERROR,"closerel:close of'%s' before any relation was opened",
615+
elog(ERROR,"close of%s before any relation was opened",
609616
name);
610617
}
611618

@@ -637,7 +644,7 @@ DefineAttr(char *name, char *type, int attnum)
637644

638645
if (boot_reldesc!=NULL)
639646
{
640-
elog(LOG,"warning:no open relations allowed with'create' command");
647+
elog(WARNING,"no open relations allowed withCREATE command");
641648
closerel(relname);
642649
}
643650

@@ -770,7 +777,7 @@ InsertOneValue(char *value, int i)
770777

771778
AssertArg(i >=0||i<MAXATTR);
772779

773-
elog(DEBUG4,"inserting column %d value'%s'",i,value);
780+
elog(DEBUG4,"inserting column %d value\"%s\"",i,value);
774781

775782
if (Typ!= (structtypmap**)NULL)
776783
{
@@ -783,7 +790,7 @@ InsertOneValue(char *value, int i)
783790
ap=*app;
784791
if (ap==NULL)
785792
{
786-
elog(FATAL,"unable to find atttypid %u in Typ list",
793+
elog(FATAL,"could not find atttypid %u in Typ list",
787794
boot_reldesc->rd_att->attrs[i]->atttypid);
788795
}
789796
values[i]=OidFunctionCall3(ap->am_typ.typinput,
@@ -875,7 +882,7 @@ cleanup(void)
875882
beenhere=1;
876883
else
877884
{
878-
elog(FATAL,"Memory manager fault:cleanup called twice");
885+
elog(FATAL,"cleanup called twice");
879886
proc_exit(1);
880887
}
881888
if (boot_reldesc!=NULL)
@@ -946,7 +953,7 @@ gettype(char *type)
946953
heap_close(rel,NoLock);
947954
returngettype(type);
948955
}
949-
elog(ERROR,"Error: unknowntype'%s'.\n",type);
956+
elog(ERROR,"unrecognizedtype\"%s\"",type);
950957
err_out();
951958
/* not reached, here to make compiler happy */
952959
return0;
@@ -962,7 +969,7 @@ AllocateAttribute(void)
962969
Form_pg_attributeattribute= (Form_pg_attribute)malloc(ATTRIBUTE_TUPLE_SIZE);
963970

964971
if (!PointerIsValid(attribute))
965-
elog(FATAL,"AllocateAttribute: malloc failed");
972+
elog(FATAL,"out of memory");
966973
MemSet(attribute,0,ATTRIBUTE_TUPLE_SIZE);
967974

968975
returnattribute;
@@ -1109,14 +1116,8 @@ AddStr(char *str, int strlength, int mderef)
11091116
inthashresult;
11101117
intlen;
11111118

1112-
if (++strtable_end==STRTABLESIZE)
1113-
{
1114-
/* Error, string table overflow, so we Punt */
1115-
elog(FATAL,
1116-
"There are too many string constants and identifiers for the compiler to handle.");
1117-
1118-
1119-
}
1119+
if (++strtable_end >=STRTABLESIZE)
1120+
elog(FATAL,"bootstrap string table overflow");
11201121

11211122
/*
11221123
* Some of the utilites (eg, define type, create relation) assume that

‎src/backend/lib/dllist.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.25 2002/06/20 20:29:28 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.26 2003/07/22 23:30:37 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -35,10 +35,12 @@ DLNewList(void)
3535
if (l==NULL)
3636
{
3737
#ifdefFRONTEND
38-
fprintf(stderr,"Memory exhausted in DLNewList\n");
38+
fprintf(stderr,"memory exhausted in DLNewList\n");
3939
exit(1);
4040
#else
41-
elog(ERROR,"Memory exhausted in DLNewList");
41+
ereport(ERROR,
42+
(errcode(ERRCODE_OUT_OF_MEMORY),
43+
errmsg("out of memory")));
4244
#endif
4345
}
4446
l->dll_head=0;
@@ -78,10 +80,12 @@ DLNewElem(void *val)
7880
if (e==NULL)
7981
{
8082
#ifdefFRONTEND
81-
fprintf(stderr,"Memory exhausted in DLNewElem\n");
83+
fprintf(stderr,"memory exhausted in DLNewElem\n");
8284
exit(1);
8385
#else
84-
elog(ERROR,"Memory exhausted in DLNewElem");
86+
ereport(ERROR,
87+
(errcode(ERRCODE_OUT_OF_MEMORY),
88+
errmsg("out of memory")));
8589
#endif
8690
}
8791
e->dle_next=0;

‎src/backend/nodes/bitmapset.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2003, PostgreSQL Global Development Group
1515
*
1616
* IDENTIFICATION
17-
* $Header: /cvsroot/pgsql/src/backend/nodes/bitmapset.c,v 1.2 2003/06/29 23:05:04 tgl Exp $
17+
* $Header: /cvsroot/pgsql/src/backend/nodes/bitmapset.c,v 1.3 2003/07/22 23:30:37 tgl Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -184,7 +184,7 @@ bms_make_singleton(int x)
184184
bitnum;
185185

186186
if (x<0)
187-
elog(ERROR,"bms_make_singleton:negativeset member not allowed");
187+
elog(ERROR,"negativebitmapset member not allowed");
188188
wordnum=WORDNUM(x);
189189
bitnum=BITNUM(x);
190190
result= (Bitmapset*)palloc0(BITMAPSET_SIZE(wordnum+1));
@@ -354,7 +354,7 @@ bms_is_member(int x, const Bitmapset *a)
354354

355355
/* XXX better to just return false for x<0 ? */
356356
if (x<0)
357-
elog(ERROR,"bms_is_member:negativeset member not allowed");
357+
elog(ERROR,"negativebitmapset member not allowed");
358358
if (a==NULL)
359359
return false;
360360
wordnum=WORDNUM(x);
@@ -431,7 +431,7 @@ bms_singleton_member(const Bitmapset *a)
431431
intwordnum;
432432

433433
if (a==NULL)
434-
elog(ERROR,"bms_singleton_member: set is empty");
434+
elog(ERROR,"bitmapset is empty");
435435
nwords=a->nwords;
436436
for (wordnum=0;wordnum<nwords;wordnum++)
437437
{
@@ -440,7 +440,7 @@ bms_singleton_member(const Bitmapset *a)
440440
if (w!=0)
441441
{
442442
if (result >=0||HAS_MULTIPLE_ONES(w))
443-
elog(ERROR,"bms_singleton_member: set has multiple members");
443+
elog(ERROR,"bitmapset has multiple members");
444444
result=wordnum*BITS_PER_BITMAPWORD;
445445
while ((w&255)==0)
446446
{
@@ -451,7 +451,7 @@ bms_singleton_member(const Bitmapset *a)
451451
}
452452
}
453453
if (result<0)
454-
elog(ERROR,"bms_singleton_member: set is empty");
454+
elog(ERROR,"bitmapset is empty");
455455
returnresult;
456456
}
457457

@@ -558,7 +558,7 @@ bms_add_member(Bitmapset *a, int x)
558558
bitnum;
559559

560560
if (x<0)
561-
elog(ERROR,"bms_add_member:negativeset member not allowed");
561+
elog(ERROR,"negativebitmapset member not allowed");
562562
if (a==NULL)
563563
returnbms_make_singleton(x);
564564
wordnum=WORDNUM(x);
@@ -598,7 +598,7 @@ bms_del_member(Bitmapset *a, int x)
598598
bitnum;
599599

600600
if (x<0)
601-
elog(ERROR,"bms_del_member:negativeset member not allowed");
601+
elog(ERROR,"negativebitmapset member not allowed");
602602
if (a==NULL)
603603
returnNULL;
604604
wordnum=WORDNUM(x);

‎src/backend/nodes/copyfuncs.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Portions Copyright (c) 1994, Regents of the University of California
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.259 2003/07/03 16:32:20 tgl Exp $
18+
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.260 2003/07/22 23:30:37 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -1328,7 +1328,8 @@ _copyAConst(A_Const *from)
13281328
/* nothing to do */
13291329
break;
13301330
default:
1331-
elog(ERROR,"_copyAConst: unknown node type %d",from->val.type);
1331+
elog(ERROR,"unrecognized node type: %d",
1332+
(int)from->val.type);
13321333
break;
13331334
}
13341335

@@ -2443,7 +2444,8 @@ _copyValue(Value *from)
24432444
/* nothing to do */
24442445
break;
24452446
default:
2446-
elog(ERROR,"_copyValue: unknown node type %d",from->type);
2447+
elog(ERROR,"unrecognized node type: %d",
2448+
(int)from->type);
24472449
break;
24482450
}
24492451
returnnewnode;
@@ -2966,8 +2968,7 @@ copyObject(void *from)
29662968
break;
29672969

29682970
default:
2969-
elog(ERROR,"copyObject: don't know how to copy node type %d",
2970-
nodeTag(from));
2971+
elog(ERROR,"unrecognized node type: %d", (int)nodeTag(from));
29712972
retval=from;/* keep compiler quiet */
29722973
break;
29732974
}

‎src/backend/nodes/equalfuncs.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Portions Copyright (c) 1994, Regents of the University of California
1919
*
2020
* IDENTIFICATION
21-
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.202 2003/07/03 16:32:32 tgl Exp $
21+
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.203 2003/07/22 23:30:37 tgl Exp $
2222
*
2323
*-------------------------------------------------------------------------
2424
*/
@@ -189,7 +189,7 @@ _equalParam(Param *a, Param *b)
189189
COMPARE_SCALAR_FIELD(paramid);
190190
break;
191191
default:
192-
elog(ERROR,"_equalParam: Invalid paramkind value: %d",
192+
elog(ERROR,"unrecognized paramkind value: %d",
193193
a->paramkind);
194194
}
195195

@@ -1616,7 +1616,7 @@ _equalValue(Value *a, Value *b)
16161616
/* nothing to do */
16171617
break;
16181618
default:
1619-
elog(ERROR,"_equalValue: unknownnode type %d",a->type);
1619+
elog(ERROR,"unrecognizednode type: %d", (int)a->type);
16201620
break;
16211621
}
16221622

@@ -1630,7 +1630,7 @@ _equalValue(Value *a, Value *b)
16301630
bool
16311631
equal(void*a,void*b)
16321632
{
1633-
boolretval= false;
1633+
boolretval;
16341634

16351635
if (a==b)
16361636
return true;
@@ -2081,8 +2081,9 @@ equal(void *a, void *b)
20812081
break;
20822082

20832083
default:
2084-
elog(WARNING,"equal: don't know whether nodes of type %d are equal",
2085-
nodeTag(a));
2084+
elog(ERROR,"unrecognized node type: %d",
2085+
(int)nodeTag(a));
2086+
retval= false;/* keep compiler quiet */
20862087
break;
20872088
}
20882089

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp