asyncpg icon indicating copy to clipboard operation
asyncpg copied to clipboard

Add support for `WHERE` clause in `copy_to` methods

Open redgoldlace opened this issue 3 years ago • 1 comments

Hi there,

This PR closes issue #939, and adds support for a where parameter in the copy_to family of methods. It is not a breaking change and will not affect existing code. Apologies for the delay - work has been pretty crazy the past couple days.

There are a couple things I'm unsure of here and wanted to flag:

  • Is the addition of UnsupportedServerFeatureError warranted? The existing exception types didn't seem like a good fit, but maybe this is too much of a special case to warrant its own.
  • Is raising an exception the desired behavior on unsupported Postgres versions? I don't really see a reasonable way to "backport" this behavior in order to avoid an exception, but maybe I'm missing something.
    • There is the option of issuing a warning instead, and allowing the inevitable syntax error to bubble up. But that feels a bit convoluted to me and isn't something I like.

If anything here looks off, please let me know. Thanks!

redgoldlace avatar Jul 30 '22 11:07 redgoldlace

Whoops, just realized that I didn't request a review. @elprans, any chance you'd be able to take a look? I think I'm unable to use the usual GitHub flow for it since this is my first PR?

redgoldlace avatar Aug 03 '22 10:08 redgoldlace