COPY table FROM STDIN

[prev] [thread] [next] [Date index for 2004/07/23]

From: Andy Harrison
Subject: COPY table FROM STDIN
Date: 13:14 on 23 Jul 2004
How can I do this from Class::DBI?

I wrote a parser script that you can filter a maillog through (tail
-10000 /var/log/maillog | maillog_parser.pl) and it writes sql files
for me to do COPY table FROM for postgresql.

Postgresql requires super user privs to do COPY table FROM 'filename'
but anyone can do it from STDIN.

I found this snippet of documention in DBD::Pg, but I'm not sure how
to implement it.

> $ret = $dbh->func($line, 'putline');
> 
> Used together with the SQL-command 'COPY table FROM STDIN' to copy 
> large amount of data into a table avoiding the overhead of using single 
> insert-comands. The application must explicitly send the two characters 
> ``\.'' to indicate to the backend that it has finished sending its data. See 
> test.pl for an example on how to use this function.

        -- 
        Andy Harrison

COPY table FROM STDIN
Andy Harrison 13:14 on 23 Jul 2004

Re: COPY table FROM STDIN
Andy Harrison 19:30 on 23 Jul 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52