COPY with PostgreSQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am using COPY for PostgreSQL and having problems now that the incoming file contains more than approx 1500 lines. Is this an issue anyone is aware of? Lot's of files over 1000 lines have worked fine, but after getting a file over 1800 I began having problems. I have broke the file down to a approx. 1500 line that works sometimes and not others. Here is a snippet of what I'm trying to do:

  $result = pg_exec($dbh, "COPY tblxrf FROM stdin USING DELIMITERS ','");
  fseek($temp_fh,0); // go to beginning of temp file
  while (($csv_line = fgets($temp_fh,1024))) {
   pg_put_line($dbh, $csv_line);
  }
  $stat = pg_put_line($dbh, "\\.\n"); // notify db finished or report error
  if (!$stat) { echo "ERROR: An error has occurred while putting last line of copy data<br>\n"; exit; }
  $stat = pg_end_copy($dbh); // post (sync data) or report error

The process just hangs with the large number of lines, I have to kill the COPY process for postgresql on the server before trying again.

--
Robert

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux