Re: 7.4 COPY BINARY Format Change

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: 7.4 COPY BINARY Format Change
Date: 2003-08-01 16:35:35
Message-ID: 16160.1059755735@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Lee Kindness <lkindness(at)csl(dot)co(dot)uk> writes:
> I've attached a patch which lets COPY read in the 7.1 format. However
> i'm not convinced this is the right way to go - I think the format
> which is output by 7.4 should be identical to the 7.1 format.

You are greatly underestimating the changes that occurred in COPY BINARY.
If the format difference had been as minor as you think, I would not
have gratuitously broken compatibility.

The real change that occurred here is that the individual data fields
go through per-datatype send/receive routines, which in addition to
implementing a mostly machine-independent binary format also provide
defenses against bad input data.

To continue to read the old COPY BINARY format, we'd have to bypass
those routines and allow direct read of the internal data formats.
This was a security risk before and would be a much bigger one now,
seeing that we allow COPY BINARY FROM STDIN to unprivileged users. It
is trivial to crash the backend by feeding it bad internal-format data.

(I don't believe that the patch works anyway, given that you aren't doing
anything to disable use of the per-datatype receive routine. It might
work as-is for text fields, and for integers on bigendian machines, but
not for much else.)

We are not going back to the pre-7.4 format. Sorry.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2003-08-01 17:11:44 cvs head compile failure
Previous Message Peter Eisentraut 2003-08-01 15:52:26 Re: contrib compilation probs

Browse pgsql-patches by date

  From Date Subject
Next Message Serguei A. Mokhov 2003-08-01 16:45:15 Re: [pgsql-rus] Russian NLS update: pg_dump, libpq,
Previous Message Peter Eisentraut 2003-08-01 16:19:38 Re: Russian NLS Update: psql