On Fri, Jul 2, 2010 at 1:28 PM, Babu R <babu_4blog@yahoo.com> wrote:
>
> Hi Pavel,
>
> Thanks.
>
> The situation is, I have the DB class which will return the connection object that is created using the PDO class.
Andam using that object to perform the db operations. ie: $DB->prepare("")
>
> Further I have the data in a CSV file which has to be inserted into the table.
>
> Here is the command that I have used to import that data:
>
> $DB->exec("\COPY table1 FROM data.csv WITH DELIMITERS ','");
As mentioned earlier just use copy, also look into using copy from
stdin and then just feeding the lines to pgsql through php instead of
having pgsql get it from a system file. This way the php script and
the db don't have to be on the same machine.