Re: COPY FROM STDIN not in local file

From: Josh Close <narshe(at)gmail(dot)com>
To: POSTGRES <pgsql-general(at)postgresql(dot)org>
Subject: Re: COPY FROM STDIN not in local file
Date: 2004-09-30 20:44:18
Message-ID: 4a0cafe204093013443d2c7a89@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 29 Sep 2004 14:40:34 -0500, Josh Close <narshe(at)gmail(dot)com> wrote:
> Is there a way to do COPY FROM STDIN from sql? So, remotely I could
> run the copy command and somehow push the info over instead of having
> it on the server.

For those who are curious, I found a php implementation of this. It
uses the postgre put_line function.

<?php
$conn = pg_pconnect("dbname=foo");
pg_query($conn, "create table bar (a int4, b char(16), d float8)");
pg_query($conn, "copy bar from stdin");
pg_put_line($conn, "3\thello world\t4.5\n");
pg_put_line($conn, "4\tgoodbye world\t7.11\n");
pg_put_line($conn, "\\.\n");
pg_end_copy($conn);
?>

-Josh

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Josh Close 2004-09-30 20:50:22 Re: postgres start problems with memory
Previous Message Greg Stark 2004-09-30 20:40:58 Re: postgres start problems with memory