RE: Add partial :-variable expansion to psql \copy
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Fabien COELHO <coelho@cri.ensmp.fr>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-03-31T11:51:13Z
Lists: pgsql-hackers
Attachments
- psql-copy-var-1.patch (text/x-patch) patch
Always better with a file attached :-/ Sorry for the noise. -- Fabien. ________________________________ De : Fabien COELHO <coelho@cri.ensmp.fr> Envoyé : lundi 31 mars 2025 13:48 À : PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org> Objet : Add partial :-variable expansion to psql \copy 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 →
-
Fix psql's "\g target" meta-command to work with COPY TO STDOUT.
- 6d3ede5f1c65 12.0 cited