Add partial :-variable expansion to psql \copy

Fabien COELHO <coelho@cri.ensmp.fr>

From: Fabien COELHO <coelho@cri.ensmp.fr>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-03-31T11:48:30Z
Lists: pgsql-hackers
Hello,

I've been biten by psql's \copy lack of variable expansion, in a limited-access docker-inside-VM context where COPY is not a viable option and hardwired names are not desirable. The attached patch allows \copy to use variable's values in place of table and file names:

```psql
\set table 'some table'
\set input 'some file name.csv'
\copy :"table" from :'input' with (format csv)
```

--
Fabien.

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix psql's "\g target" meta-command to work with COPY TO STDOUT.