Thread: COPY improvements

COPY improvements

From
nconway@klamath.dyndns.org (Neil Conway)
Date:
The attached patch completes the following TODO item:

    * Generate failure on short COPY lines rather than pad NULLs

I also restructed a lot of the existing COPY code, did some code
review on the column list patch sent in by Brent Verner a little
while ago, and added some regression tests. I also added an
explicit check (and resultant error) for extra data before
the end-of-line.

Since COPY is pretty important, I think this should be tested
pretty well before we release 7.3.

Cheers,

Neil

--
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC

Attachment

Re: COPY improvements

From
nconway@klamath.dyndns.org (Neil Conway)
Date:
On Thu, Jul 25, 2002 at 04:25:35PM -0400, Neil Conway wrote:
> The attached patch completes the following TODO item:
>
>     * Generate failure on short COPY lines rather than pad NULLs

I've attached an improved patch. This patch fixes a regression test
failure in the previous patch, updates the documentation for the
new behavior of COPY, and makes the handling of COPY TO/FROM
WITH OIDS into a table without OIDs more consistent (plus regression
tests for the same).

I'm not sure if the "bail out if we encounter extra data" check
is too strict -- any comments?

Cheers,

Neil

--
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC

Attachment

Re: COPY improvements

From
Bruce Momjian
Date:
Your patch has been added to the PostgreSQL unapplied patches list at:

    http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Neil Conway wrote:
> On Thu, Jul 25, 2002 at 04:25:35PM -0400, Neil Conway wrote:
> > The attached patch completes the following TODO item:
> >
> >     * Generate failure on short COPY lines rather than pad NULLs
>
> I've attached an improved patch. This patch fixes a regression test
> failure in the previous patch, updates the documentation for the
> new behavior of COPY, and makes the handling of COPY TO/FROM
> WITH OIDS into a table without OIDs more consistent (plus regression
> tests for the same).
>
> I'm not sure if the "bail out if we encounter extra data" check
> is too strict -- any comments?
>
> Cheers,
>
> Neil
>
> --
> Neil Conway <neilconway@rogers.com>
> PGP Key ID: DB3C29FC

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

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

Re: COPY improvements

From
Bruce Momjian
Date:
IMPROVED VERSION APPLIED.

Patch applied.  Thanks.

---------------------------------------------------------------------------


Neil Conway wrote:
> The attached patch completes the following TODO item:
>
>     * Generate failure on short COPY lines rather than pad NULLs
>
> I also restructed a lot of the existing COPY code, did some code
> review on the column list patch sent in by Brent Verner a little
> while ago, and added some regression tests. I also added an
> explicit check (and resultant error) for extra data before
> the end-of-line.
>
> Since COPY is pretty important, I think this should be tested
> pretty well before we release 7.3.
>
> Cheers,
>
> Neil
>
> --
> Neil Conway <neilconway@rogers.com>
> PGP Key ID: DB3C29FC

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

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

Re: COPY improvements

From
Bruce Momjian
Date:
This is the one I actually applied.

---------------------------------------------------------------------------

Neil Conway wrote:
> On Thu, Jul 25, 2002 at 04:25:35PM -0400, Neil Conway wrote:
> > The attached patch completes the following TODO item:
> >
> >     * Generate failure on short COPY lines rather than pad NULLs
>
> I've attached an improved patch. This patch fixes a regression test
> failure in the previous patch, updates the documentation for the
> new behavior of COPY, and makes the handling of COPY TO/FROM
> WITH OIDS into a table without OIDs more consistent (plus regression
> tests for the same).
>
> I'm not sure if the "bail out if we encounter extra data" check
> is too strict -- any comments?
>
> Cheers,
>
> Neil
>
> --
> Neil Conway <neilconway@rogers.com>
> PGP Key ID: DB3C29FC

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

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

Re: COPY improvements

From
Bruce Momjian
Date:
Neil Conway wrote:
> On Thu, Jul 25, 2002 at 04:25:35PM -0400, Neil Conway wrote:
> > The attached patch completes the following TODO item:
> >
> >     * Generate failure on short COPY lines rather than pad NULLs
>
> I've attached an improved patch. This patch fixes a regression test
> failure in the previous patch, updates the documentation for the
> new behavior of COPY, and makes the handling of COPY TO/FROM
> WITH OIDS into a table without OIDs more consistent (plus regression
> tests for the same).
>
> I'm not sure if the "bail out if we encounter extra data" check
> is too strict -- any comments?

If the COPY row has too little data or too much data, you have to abort
the COPY.

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