tuple count and v3 functions in psql for COPY

From: Volkan YAZICI <yazicivo(at)ttnet(dot)net(dot)tr>
To: pgsql-patches(at)postgresql(dot)org
Subject: tuple count and v3 functions in psql for COPY
Date: 2005-12-18 10:13:17
Message-ID: 20051218101317.GA548@alamut
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

I tried to prepare a patch for these TODO items:
- Have COPY return the number of rows loaded/unloaded?
- Update [pg_dump and] psql to use the new COPY libpq API.

Added an "uint64 processed" to "struct CopyStateData". It's
incremented each time on a tuple send/receive made by
CopyTo/CopyFrom. Collected result is added to COPY command's
commandTag which can be gathered by PQcmdStatus(). (Also updated
PQcmdTuples() to work with it.)

When I tried to modify psql to print the COPY's commandTag, I found
that its implementation is really disorganized when we still use old
COPY commands. Thus replaced old COPY routines with the new ones.
(IMHO, modified design for the psql's COPY should work faster than
the previous. Because, in this patch, I don't read input one by one
with getc(). Just filled the buffer with fgets and made \r search
only in the first and last lines.)

Regards.

--
"We are the middle children of history, raised by television to believe
that someday we'll be millionaires and movie stars and rock stars, but
we won't. And we're just learning this fact," Tyler said. "So don't
fuck with us."

Attachment Content-Type Size
copy_cmdstatus.patch.3 text/plain 20.3 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2005-12-18 18:55:26 Re: Single-Transaction Utility options
Previous Message Karl O. Pinc 2005-12-18 07:29:45 Re: Converting seconds past midnight to a time