Minor code cleanup: calling FreeFile() before ereport(ERROR) is not
necessary, since files opened via AllocateFile() are closed automatically as part of error recovery.
This commit is contained in:
parent
9cce91dba0
commit
c1d89c61fc
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.284 2007/06/17 23:39:28 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.285 2007/06/20 02:02:49 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1223,13 +1223,10 @@ DoCopyTo(CopyState cstate)
|
|||||||
|
|
||||||
fstat(fileno(cstate->copy_file), &st);
|
fstat(fileno(cstate->copy_file), &st);
|
||||||
if (S_ISDIR(st.st_mode))
|
if (S_ISDIR(st.st_mode))
|
||||||
{
|
|
||||||
FreeFile(cstate->copy_file);
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
errmsg("\"%s\" is a directory", cstate->filename)));
|
errmsg("\"%s\" is a directory", cstate->filename)));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
PG_TRY();
|
PG_TRY();
|
||||||
{
|
{
|
||||||
@ -1728,13 +1725,10 @@ CopyFrom(CopyState cstate)
|
|||||||
|
|
||||||
fstat(fileno(cstate->copy_file), &st);
|
fstat(fileno(cstate->copy_file), &st);
|
||||||
if (S_ISDIR(st.st_mode))
|
if (S_ISDIR(st.st_mode))
|
||||||
{
|
|
||||||
FreeFile(cstate->copy_file);
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
errmsg("\"%s\" is a directory", cstate->filename)));
|
errmsg("\"%s\" is a directory", cstate->filename)));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
tupDesc = RelationGetDescr(cstate->rel);
|
tupDesc = RelationGetDescr(cstate->rel);
|
||||||
attr = tupDesc->attrs;
|
attr = tupDesc->attrs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user