psql and pg_dump using obselete copy commands

Started by Christopher Kings-Lynnealmost 21 years ago6 messages
#1Christopher Kings-Lynne
chriskl@familyhealth.com.au

Should psql and pg_dump be upgraded to use the new v3 protocol copy
functions if they are available, as they are currently using the
deprecated API.

Chris

#2Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Christopher Kings-Lynne (#1)
Re: psql and pg_dump using obselete copy commands

Christopher Kings-Lynne wrote:

Should psql and pg_dump be upgraded to use the new v3 protocol copy
functions if they are available, as they are currently using the
deprecated API.

We have been telling people to use newer pg_dump's on older servers, but
we only support reloading into the current PostgreSQL version, so I see
no reason not to updated it to the current syntax.

We added the new syntax in 7.3.

Added to TODO:

o Update pg_dump to use the newer COPY syntax

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Bruce Momjian (#2)
Re: psql and pg_dump using obselete copy commands

We have been telling people to use newer pg_dump's on older servers, but
we only support reloading into the current PostgreSQL version, so I see
no reason not to updated it to the current syntax.

We added the new syntax in 7.3.

Added to TODO:

o Update pg_dump to use the newer COPY syntax

I think you misunderstood me - all I think we should do is switch to
using PQgetCopyData instead of PQgetline (deprecated) if the libpq
pg_dump is built against has it. (And the protocol supports it.)

Same for PQputCopyData vs. PQputline.

Chris

#4Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Christopher Kings-Lynne (#3)
Re: psql and pg_dump using obselete copy commands

Christopher Kings-Lynne wrote:

We have been telling people to use newer pg_dump's on older servers, but
we only support reloading into the current PostgreSQL version, so I see
no reason not to updated it to the current syntax.

We added the new syntax in 7.3.

Added to TODO:

o Update pg_dump to use the newer COPY syntax

I think you misunderstood me - all I think we should do is switch to
using PQgetCopyData instead of PQgetline (deprecated) if the libpq
pg_dump is built against has it. (And the protocol supports it.)

Same for PQputCopyData vs. PQputline.

Oh, if we do that, do we disallow connecting to older servers?

TODO item removed.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#5Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Bruce Momjian (#4)
Re: psql and pg_dump using obselete copy commands

Oh, if we do that, do we disallow connecting to older servers?

Not at all, since the logic would be like this:

if we have new copy functions
and we have protocol version function
and protocol version >= 3
then use new copy functions
else
use old copy functions

That would be even simpler if someone would answer my question about the
new copy functions working on a pre v3 server. (I'm setting up to test
that atm)

Chris

#6Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Christopher Kings-Lynne (#5)
Re: psql and pg_dump using obselete copy commands

Christopher Kings-Lynne wrote:

Oh, if we do that, do we disallow connecting to older servers?

Not at all, since the logic would be like this:

if we have new copy functions
and we have protocol version function
and protocol version >= 3
then use new copy functions
else
use old copy functions

That would be even simpler if someone would answer my question about the
new copy functions working on a pre v3 server. (I'm setting up to test
that atm)

I just talked to Christopher via IM. He says the new fuctions work with
older server, and pg_dump always uses the libpq version that shipped
with that version (or a newer one) so we have for TODO added:

o Update pg_dump and psql to use the new COPY libpq API

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073