COPY with PostgreSQL
| From: | Robert Fitzpatrick | Date: | Fri, 22 Oct 2004 06:18:14 +0000 |
| Subject: | COPY with PostgreSQL | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-36968@lists.php.net to get a copy of this message | ||
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