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

Commitdeea69b

Browse files
committed
Change some ABORTS to ERROR. Add line number when COPY Failure.
1 parent3d8820a commitdeea69b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+571
-589
lines changed

‎src/backend/commands/_deadcode/version.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.10 1998/01/0503:30:58 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.11 1998/01/0516:39:07 momjian Exp $
1414
*
1515
* NOTES
1616
* At the point the version is defined, 2 physical relations are created
@@ -195,7 +195,7 @@ setAttrList(char *bname)
195195
rdesc=heap_openr(bname);
196196
if (rdesc==NULL)
197197
{
198-
elog(ABORT,"Unable to expand all -- amopenr failed ");
198+
elog(ERROR,"Unable to expand all -- amopenr failed ");
199199
return;
200200
}
201201
maxattrs=RelationGetNumberOfAttributes(rdesc);

‎src/backend/commands/cluster.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.20 1998/01/0503:30:38 momjian Exp $
17+
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.21 1998/01/0516:38:42 momjian Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -125,15 +125,15 @@ cluster(char oldrelname[], char oldindexname[])
125125
OldHeap=heap_openr(oldrelname);
126126
if (!RelationIsValid(OldHeap))
127127
{
128-
elog(ABORT,"cluster: unknown relation: \"%s\"",
128+
elog(ERROR,"cluster: unknown relation: \"%s\"",
129129
oldrelname);
130130
}
131131
OIDOldHeap=OldHeap->rd_id;/* Get OID for the index scan*/
132132

133133
OldIndex=index_openr(oldindexname);/* Open old index relation*/
134134
if (!RelationIsValid(OldIndex))
135135
{
136-
elog(ABORT,"cluster: unknown index: \"%s\"",
136+
elog(ERROR,"cluster: unknown index: \"%s\"",
137137
oldindexname);
138138
}
139139
OIDOldIndex=OldIndex->rd_id;/* OID for the index scan */
@@ -218,7 +218,7 @@ copy_heap(Oid OIDOldHeap)
218218
OIDNewHeap=heap_create_with_catalog(NewName,tupdesc);
219219

220220
if (!OidIsValid(OIDNewHeap))
221-
elog(ABORT,"clusterheap: cannot create temporary heap relation\n");
221+
elog(ERROR,"clusterheap: cannot create temporary heap relation\n");
222222

223223
NewHeap=heap_open(OIDNewHeap);
224224

‎src/backend/commands/command.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.22 1998/01/0503:30:39 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.23 1998/01/0516:38:44 momjian Exp $
1111
*
1212
* NOTES
1313
* The PortalExecutorHeapMemory crap needs to be eliminated
@@ -294,21 +294,21 @@ PerformAddAttribute(char *relationName,
294294
* normally, only the owner of a class can change its schema.
295295
*/
296296
if (IsSystemRelationName(relationName))
297-
elog(ABORT,"PerformAddAttribute: class \"%s\" is a system catalog",
297+
elog(ERROR,"PerformAddAttribute: class \"%s\" is a system catalog",
298298
relationName);
299299
#ifndefNO_SECURITY
300300
if (!pg_ownercheck(userName,relationName,RELNAME))
301-
elog(ABORT,"PerformAddAttribute: you do not own class \"%s\"",
301+
elog(ERROR,"PerformAddAttribute: you do not own class \"%s\"",
302302
relationName);
303303
#endif
304304

305305
/*
306306
* we can't add a not null attribute
307307
*/
308308
if (colDef->is_not_null)
309-
elog(ABORT,"Can't add a NOT NULL attribute to an existing relation");
309+
elog(ERROR,"Can't add a NOT NULL attribute to an existing relation");
310310
if (colDef->defval)
311-
elog(ABORT,"ADD ATTRIBUTE: DEFAULT not yet implemented");
311+
elog(ERROR,"ADD ATTRIBUTE: DEFAULT not yet implemented");
312312

313313
/*
314314
* if the first element in the 'schema' list is a "*" then we are
@@ -331,7 +331,7 @@ PerformAddAttribute(char *relationName,
331331
relrdesc=heap_openr(relationName);
332332
if (!RelationIsValid(relrdesc))
333333
{
334-
elog(ABORT,"PerformAddAttribute: unknown relation: \"%s\"",
334+
elog(ERROR,"PerformAddAttribute: unknown relation: \"%s\"",
335335
relationName);
336336
}
337337
myrelid=relrdesc->rd_id;
@@ -353,7 +353,7 @@ PerformAddAttribute(char *relationName,
353353
relrdesc=heap_open(childrelid);
354354
if (!RelationIsValid(relrdesc))
355355
{
356-
elog(ABORT,"PerformAddAttribute: can't find catalog entry for inheriting class with oid %d",
356+
elog(ERROR,"PerformAddAttribute: can't find catalog entry for inheriting class with oid %d",
357357
childrelid);
358358
}
359359
PerformAddAttribute((relrdesc->rd_rel->relname).data,
@@ -369,7 +369,7 @@ PerformAddAttribute(char *relationName,
369369
if (!PointerIsValid(reltup))
370370
{
371371
heap_close(relrdesc);
372-
elog(ABORT,"PerformAddAttribute: relation \"%s\" not found",
372+
elog(ERROR,"PerformAddAttribute: relation \"%s\" not found",
373373
relationName);
374374
}
375375

@@ -378,7 +378,7 @@ PerformAddAttribute(char *relationName,
378378
*/
379379
if (((Form_pg_class)GETSTRUCT(reltup))->relkind==RELKIND_INDEX)
380380
{
381-
elog(ABORT,"PerformAddAttribute: index relation \"%s\" not changed",
381+
elog(ERROR,"PerformAddAttribute: index relation \"%s\" not changed",
382382
relationName);
383383
return;
384384
}
@@ -389,7 +389,7 @@ PerformAddAttribute(char *relationName,
389389
{
390390
pfree(reltup);/* XXX temp */
391391
heap_close(relrdesc);/* XXX temp */
392-
elog(ABORT,"PerformAddAttribute: relations limited to %d attributes",
392+
elog(ERROR,"PerformAddAttribute: relations limited to %d attributes",
393393
MaxHeapAttributeNumber);
394394
return;
395395
}
@@ -450,7 +450,7 @@ PerformAddAttribute(char *relationName,
450450
heap_endscan(attsdesc);/* XXX temp */
451451
heap_close(attrdesc);/* XXX temp */
452452
heap_close(relrdesc);/* XXX temp */
453-
elog(ABORT,"PerformAddAttribute: attribute \"%s\" already exists in class \"%s\"",
453+
elog(ERROR,"PerformAddAttribute: attribute \"%s\" already exists in class \"%s\"",
454454
key[1].sk_argument,
455455
relationName);
456456
return;
@@ -478,7 +478,7 @@ PerformAddAttribute(char *relationName,
478478

479479
if (!HeapTupleIsValid(typeTuple))
480480
{
481-
elog(ABORT,"Add: type \"%s\" nonexistent",p);
481+
elog(ERROR,"Add: type \"%s\" nonexistent",p);
482482
}
483483
namestrcpy(&(attribute->attname), (char*)key[1].sk_argument);
484484
attribute->atttypid=typeTuple->t_oid;

‎src/backend/commands/copy.c

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.36 1998/01/0503:30:41 momjian Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.37 1998/01/0516:38:46 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -67,11 +67,8 @@ static intCountTuples(Relation relation);
6767
externFILE*Pfout,
6868
*Pfin;
6969

70-
#ifdefCOPY_DEBUG
7170
staticintlineno;
7271

73-
#endif
74-
7572
/*
7673
* DoCopy executes a the SQL COPY statement.
7774
*/
@@ -115,15 +112,15 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
115112

116113
rel=heap_openr(relname);
117114
if (rel==NULL)
118-
elog(ABORT,"COPY command failed. Class %s "
115+
elog(ERROR,"COPY command failed. Class %s "
119116
"does not exist.",relname);
120117

121118
result=pg_aclcheck(relname,UserName,required_access);
122119
if (result!=ACLCHECK_OK)
123-
elog(ABORT,"%s: %s",relname,aclcheck_error_strings[result]);
120+
elog(ERROR,"%s: %s",relname,aclcheck_error_strings[result]);
124121
/* Above should not return */
125122
elseif (!superuser()&& !pipe)
126-
elog(ABORT,"You must have Postgres superuser privilege to do a COPY "
123+
elog(ERROR,"You must have Postgres superuser privilege to do a COPY "
127124
"directly to or from a file. Anyone can COPY to stdout or "
128125
"from stdin. Psql's \\copy command also works for anyone.");
129126
/* Above should not return. */
@@ -132,7 +129,7 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
132129
if (from)
133130
{/* copy from file to database */
134131
if (rel->rd_rel->relkind==RELKIND_SEQUENCE)
135-
elog(ABORT,"You can't change sequence relation %s",relname);
132+
elog(ERROR,"You can't change sequence relation %s",relname);
136133
if (pipe)
137134
{
138135
if (IsUnderPostmaster)
@@ -147,7 +144,7 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
147144
{
148145
fp=AllocateFile(filename,"r");
149146
if (fp==NULL)
150-
elog(ABORT,"COPY command, running in backend with "
147+
elog(ERROR,"COPY command, running in backend with "
151148
"effective uid %d, could not open file '%s' for "
152149
"reading. Errno = %s (%d).",
153150
geteuid(),filename,strerror(errno),errno);
@@ -175,7 +172,7 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
175172
fp=AllocateFile(filename,"w");
176173
umask(oumask);
177174
if (fp==NULL)
178-
elog(ABORT,"COPY command, running in backend with "
175+
elog(ERROR,"COPY command, running in backend with "
179176
"effective uid %d, could not open file '%s' for "
180177
"writing. Errno = %s (%d).",
181178
geteuid(),filename,strerror(errno),errno);
@@ -532,9 +529,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
532529
byval[i]= (bool)IsTypeByVal(attr[i]->atttypid);
533530
}
534531

535-
#ifdefCOPY_DEBUG
536532
lineno=0;
537-
#endif
538533
while (!done)
539534
{
540535
if (!binary)
@@ -543,10 +538,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
543538
intnewline=0;
544539

545540
#endif
546-
#ifdefCOPY_DEBUG
547541
lineno++;
548-
elog(DEBUG,"line %d",lineno);
549-
#endif
550542
if (oids)
551543
{
552544
#ifdefCOPY_PATCH
@@ -560,7 +552,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
560552
{
561553
loaded_oid=oidin(string);
562554
if (loaded_oid<BootstrapObjectIdData)
563-
elog(ABORT,"COPY TEXT: Invalid Oid");
555+
elog(ERROR,"COPY TEXT: Invalid Oid");
564556
}
565557
}
566558
for (i=0;i<attr_count&& !done;i++)
@@ -593,12 +585,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
593585
if (!PointerIsValid(values[i])&&
594586
!(rel->rd_att->attrs[i]->attbyval))
595587
{
596-
#ifdefCOPY_DEBUG
597-
elog(ABORT,
598-
"copy from: line %d - Bad file format",lineno);
599-
#else
600-
elog(ABORT,"copy from: Bad file format");
601-
#endif
588+
elog(ERROR,"copy from line %d: Bad file format",lineno);
602589
}
603590
}
604591
}
@@ -622,7 +609,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
622609
{
623610
fread(&loaded_oid,sizeof(int32),1,fp);
624611
if (loaded_oid<BootstrapObjectIdData)
625-
elog(ABORT,"COPY BINARY: Invalid Oid");
612+
elog(ERROR,"COPY BINARY: Invalid Oid");
626613
}
627614
fread(&null_ct,sizeof(int32),1,fp);
628615
if (null_ct>0)
@@ -661,7 +648,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
661648
ptr+=sizeof(int32);
662649
break;
663650
default:
664-
elog(ABORT,"COPY BINARY: impossible size!");
651+
elog(ERROR,"COPY BINARY: impossible size!");
665652
break;
666653
}
667654
}
@@ -837,7 +824,7 @@ GetOutputFunction(Oid type)
837824
if (HeapTupleIsValid(typeTuple))
838825
return ((int) ((TypeTupleForm)GETSTRUCT(typeTuple))->typoutput);
839826

840-
elog(ABORT,"GetOutputFunction: Cache lookup of type %d failed",type);
827+
elog(ERROR,"GetOutputFunction: Cache lookup of type %d failed",type);
841828
return (InvalidOid);
842829
}
843830

@@ -854,7 +841,7 @@ GetTypeElement(Oid type)
854841
if (HeapTupleIsValid(typeTuple))
855842
return ((int) ((TypeTupleForm)GETSTRUCT(typeTuple))->typelem);
856843

857-
elog(ABORT,"GetOutputFunction: Cache lookup of type %d failed",type);
844+
elog(ERROR,"GetOutputFunction: Cache lookup of type %d failed",type);
858845
return (InvalidOid);
859846
}
860847

@@ -870,7 +857,7 @@ GetInputFunction(Oid type)
870857
if (HeapTupleIsValid(typeTuple))
871858
return ((int) ((TypeTupleForm)GETSTRUCT(typeTuple))->typinput);
872859

873-
elog(ABORT,"GetInputFunction: Cache lookup of type %d failed",type);
860+
elog(ERROR,"GetInputFunction: Cache lookup of type %d failed",type);
874861
return (InvalidOid);
875862
}
876863

@@ -886,7 +873,7 @@ IsTypeByVal(Oid type)
886873
if (HeapTupleIsValid(typeTuple))
887874
return ((int) ((TypeTupleForm)GETSTRUCT(typeTuple))->typbyval);
888875

889-
elog(ABORT,"GetInputFunction: Cache lookup of type %d failed",type);
876+
elog(ERROR,"GetInputFunction: Cache lookup of type %d failed",type);
890877

891878
return (InvalidOid);
892879
}
@@ -1005,12 +992,7 @@ CopyReadNewline(FILE *fp, int *newline)
1005992
{
1006993
if (!*newline)
1007994
{
1008-
#ifdefCOPY_DEBUG
1009-
elog(NOTICE,"CopyReadNewline: line %d - extra fields ignored",
1010-
lineno);
1011-
#else
1012-
elog(NOTICE,"CopyReadNewline: line - extra fields ignored");
1013-
#endif
995+
elog(NOTICE,"CopyReadNewline: line %d - extra fields ignored",lineno);
1014996
while (!feof(fp)&& (getc(fp)!='\n'));
1015997
}
1016998
*newline=0;
@@ -1125,7 +1107,7 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
11251107
case'.':
11261108
c=getc(fp);
11271109
if (c!='\n')
1128-
elog(ABORT,"CopyReadAttribute - end of record marker corrupted");
1110+
elog(ERROR,"CopyReadAttribute - end of record marker corrupted");
11291111
return (NULL);
11301112
break;
11311113
}
@@ -1143,7 +1125,7 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
11431125
if (!done)
11441126
attribute[i++]=c;
11451127
if (i==EXT_ATTLEN-1)
1146-
elog(ABORT,"CopyReadAttribute - attribute length too long");
1128+
elog(ERROR,"CopyReadAttribute - attribute length too long");
11471129
}
11481130
attribute[i]='\0';
11491131
return (&attribute[0]);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp