Re: bulk copy

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: blackwater dev <blackwaterdev(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: bulk copy
Date: 2008-01-15 17:43:05
Message-ID: 20080115174304.GD7865@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 15, 2008 at 12:18:18PM -0500, blackwater dev wrote:
> Ok, fair enough, in theory, I don't want to simply trust the file to have
> clean data so will want to put the data into a huge array (php) which I can
> clean and then pump into the db. What is the best way to pump all this data
> in without doing inserts? How can I use stdin?

As the message states, if you're using psql you use the \copy command
and it all works If you're working from PHP you say "COPY FROM STDIN
..." and then use the (checks online PHP docs) pg_put_line function.

There's even an example:
http://www.maconlinux.net/php-online-manual/en/function.pg-put-line.html

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy

In response to

  • bulk copy at 2008-01-15 17:18:18 from blackwater dev

Browse pgsql-general by date

  From Date Subject
Next Message Teodor Sigaev 2008-01-15 17:45:33 Re: Segmentation fault with 8.3 FTS ISpell
Previous Message Tom Lane 2008-01-15 17:37:28 Re: varchar sort ordering ignore blanks