in reply to Re^2: pg_getcopydata failing to get copy data using documented syntax
in thread pg_getcopydata failing to get copy data using documented syntax
This is a post-increment.$dbh->pg_getcopydata(\$data[$record_count++])
When the last data record is retrieved, pg_getcopydata returns a Non-zero value, so, it is called one more time, and this time it returns NO data, but the return code is negative.
So, that last call with no data increments the $record_count unnecessarily.
Any attempt to repair this in-line loses the simplicity of the current code, so the best bet is to add a line "$record_count --", and add a comment as to why you are doing that.
Re- Quoting the $schema, $table: Ouch! spaces in these names is just poor DB design. I agree with you - adding the quotes is good practice, just for these cases (which I had not thought of).
"Battle not with trolls, lest ye become a troll; and if you gaze into the Internet, the Internet gazes also into you."
-Friedrich Nietzsche: A Dynamic Translation
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: pg_getcopydata failing to get copy data using documented syntax
by bitvector (Initiate) on Dec 28, 2011 at 21:16 UTC |