Thread: Postgresql's "copy tablefrom STDIN" and DBD-Pg.

Postgresql's "copy tablefrom STDIN" and DBD-Pg.

From
Rodney McDuff
Date:
Hi
    Is there a way of using postgresql's "copy table from STDIN"
with DBD-Pg.

--

  +-----------------+------------------------------------------+
  |    _   ^   _    | Dr. Rodney McDuff                        |
  |   |\  /|\  /|   | Network Development, ITS                 |
  |     \  |  /     | The University of Queensland             |
  |      \ | /      | St. Lucia, Brisbane                      |
  |       \|/       | Queensland, Australia. 4072.             |
  |<-------+------->| TELEPHONE: +61 7 3365 8220               |
  |       /|\       | FACSIMILE: +61 7 3365 4477               |
  |      / | \      | EMAIL: mcduff@its.uq.edu.au              |
  |     /  |  \     |                                          |
  |   |/  \|/  \|   |        Ex ignorantia ad sapientiam       |
  |    -   v   -    |            Ex luce ad tenebras           |
  +-----------------+------------------------------------------+



Re: [GENERAL] Postgresql's "copy tablefrom STDIN" and DBD-Pg.

From
Peter Eisentraut
Date:
Since COPY is PostgreSQL specific and DBD/DBI is supposed to be generic, I
don't think there's an easy way and you wouldn't be doing yourselves any
favours anyway.

If you insist on using COPY then you can use our native "Pg" Perl module,
which has functions equivalent to libpq's getline() and putline(), which
are necessary to handle COPY input and output. In the psql source code
(src/bin/psql/*.c) there are two functions called handleCopy{In|Out} that
handle this correctly, but I suspect in Perl it might be a lot easier
since you don't have to worry about memory allocation.

Good luck.

    -Peter

On 1999-11-29, Rodney McDuff mentioned:

> Hi
>     Is there a way of using postgresql's "copy table from STDIN"
> with DBD-Pg.
>
>

--
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden