title: Postgresql COPY bulk data from within PHP script - ideally using ADODB
body: <p>I have custom software which includes a function to  copy data between tables on postgresql servers.  It does this 1 row at a time, which is fine when the servers are close together, but as I've started deploying servers where the latency is > 300ms this does not work well at all.</p>
  
  <p>I believe the solution is to use the "COPY" statement, but I am having difficulty implementing it. I am using the <a href="http://www.phplens.com/lens/adodb/docs-adodb.htm" rel="nofollow noreferrer">ADODB php library</a> </p>
  
  <p>When I attempt a copy from a file I get the error "must be superuser to COPY to or from a file".    The problem is that I don't know how to copy "from STDIN" where stdin is not actually piped to the PHP script.   Is there any way to provide the stdin input as part of the sql command using ADODB, or is there an equivalent command which will allow me to do a batch insert without waiting for each individual insert ?</p>