Skip site navigation (1) Skip section navigation (2)

Re: [PATCHES] COPY when 'filename' is a directory

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>,Douglas Trainor <trainor(at)uic(dot)edu>, pgsql-bugs(at)postgresql(dot)org,pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCHES] COPY when 'filename' is a directory
Date: 2002-02-24 02:31:35
Message-ID: 200202240231.g1O2VZ304266@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patches
Tom Lane wrote:
> Brent Verner <brent(at)rcfile(dot)org> writes:
> > | This coding is WRONG.  You do not use fclose() to release a file
> > | opened with AllocateFile.
> 
> >   s/fclose/FreeFile/
> 
> Actually, my recommendation is to remove it altogether.  The mechanisms
> are in place to close allocated files after elog(), so why waste thought
> and code space to release them manually?

Fix applied.  There is a FileFree() just below this in the code:

    if (!pipe)
        FreeFile(fp);

We don't need the if (!pipe) because this code is in an else of
if(pipe).  For clarity, it seems the FreeFile call makes sense.

The psql/copy.c file is fine because it isn't backend code.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2002-02-24 02:41:28
Subject: Re: [PATCHES] COPY when 'filename' is a directory
Previous:From: Tom LaneDate: 2002-02-24 02:11:03
Subject: Re: [PATCHES] COPY when 'filename' is a directory

pgsql-patches by date

Next:From: Tom LaneDate: 2002-02-24 02:41:28
Subject: Re: [PATCHES] COPY when 'filename' is a directory
Previous:From: Tom LaneDate: 2002-02-24 02:11:03
Subject: Re: [PATCHES] COPY when 'filename' is a directory

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group