Re: COPY TO: provide hint when WHERE clause is used
Atsushi Torikoshi <torikoshia.tech@gmail.com>
From: Atsushi Torikoshi <torikoshia.tech@gmail.com>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: torikoshia <torikoshia@oss.nttdata.com>,
pgsql-hackers@lists.postgresql.org
Date: 2025-08-31T22:58:21Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add HINT for COPY TO when WHERE clause is used.
- 229911c4bf9a 19 (unreleased) landed
Attachments
- v2-0001-COPY-TO-provide-hint-when-WHERE-clause-is-used.patch (application/x-patch) patch v2-0001
On Sun, Aug 31, 2025 at 3:14 AM Jim Jones <jim.jones@uni-muenster.de> wrote: > > Hi > > On 19.08.25 03:35, torikoshia wrote: > > Considering what the user was trying to do, it might be helpful to > > provide a similar hint in this case as well. > > I’ve attached a patch that adds such a hint. > > > > What do you think? > > > > +1 > > I tested the patch and the error message now has the intended HINT ... > > postgres=# COPY t1 TO STDOUT WHERE i > 5; > ERROR: WHERE clause not allowed with COPY TO > LINE 1: COPY t1 TO STDOUT WHERE i > 5; > ^ > HINT: Try the COPY (SELECT ... WHERE ...) TO variant. > > ... which aligns with the HINT from COPY TO from views > > postgres=# COPY v1 TO STDOUT; > ERROR: cannot copy from view "v1" > HINT: Try the COPY (SELECT ...) TO variant. Thanks for your review! Updated the patch to pass regression tests.