On Thu, Apr 25, 2019 at 04:47:20PM -0000, PyGreSQL issue tracker wrote:
> #73: Allow inserttable() to take columns as parameter
>  * status:  new => closed
>  * resolution:   => wontfix
> 
>  Actually I don't think a `columns` parameter would be much useful here and
>  only tarnish the pleasant simplicity of this method. You can easily remove
>  superfluous columns from the `values` argument in Python before passing it
>  to the method. And the other `copy_from` parameters are not applicable
>  here anyway.

I don't think we're talking about the same thing.  The request was to allow
inserting columns "a,c" into a table with columns "a,b,c,d" (we need to do this
all the time).  That's needed in case columns b,d have default values
(otherwise NULL would work fine).

Doesn't this just need to accept an optional list of column names and join them 
with commas?
|sprintf(buffer, "copy %s from stdin", table);
to allow:
|COPY t(i) FROM stdin

I don't know for sure if we'd be able to use this for either of our loaders,
but I suspect it would be competitive or better than prepared statements, for
use cases where it can be applied.

Justin
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo/pygresql

Reply via email to