-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ext/pdo_pgsql: Expanding COPY input from an array to an iterable #15893
ext/pdo_pgsql: Expanding COPY input from an array to an iterable #15893
Conversation
658d696
to
36ff68d
Compare
Nice feature and qualifies for the next major release I think. looking ok overall, I would suggest trying to refactor, as much as you can, common code between the two modes. |
I'll try it. |
36ff68d
to
e141a5e
Compare
e141a5e
to
5691fb3
Compare
I tried to do as much as I could. |
Couple of things to look at I think, good news is because of this
you have the time. see next comments. |
Looking good to me, implementation-wise. I ll let it rest if someone wants to chime in about tests. |
inspired from the Pdo\Pgsql new feature phpGH-15893.
inspired from the Pdo\Pgsql new feature phpGH-15893.
inspired from the Pdo\Pgsql new feature phpGH-15893. close phpGH-16124
inspired from the Pdo\Pgsql new feature phpGH-15893. close phpGH-16124
This pull request allows
PDO::pgsqlCopyFromArray
to acceptIterable
instead of justarray
. This is not a breaking change since it still acceptsarray
.The PostgreSQL
COPY
statement is a great interface. We can bulk insert a set of records by inputting them as CSV or TSV. PostgreSQL also supports processing them as a stream.However, the current
pgsqlCopyFromArray
does not take full advantage of this capability. It requires that the records to be inserted be input as a single array, so it cannot be processed by piping external input to PostgreSQL'sCOPY
.This weakness will be overcome by supporting not only simple arrays but also
Traversable
andGenerator
.