From: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | RE: Add partial :-variable expansion to psql \copy |
Date: | 2025-03-31 11:51:13 |
Message-ID: | PR0P264MB43009A918E17B5E7B93BB900ABAD2@PR0P264MB4300.FRAP264.PROD.OUTLOOK.COM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Always better with a file attached :-/
Sorry for the noise.
--
Fabien.
________________________________
De : Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Envoyé : lundi 31 mars 2025 13:48
À : PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)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.
Attachment | Content-Type | Size |
---|---|---|
psql-copy-var-1.patch | text/x-patch | 8.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Bapat | 2025-03-31 11:54:03 | Re: Test to dump and restore objects left behind by regression |
Previous Message | Fabien COELHO | 2025-03-31 11:48:30 | Add partial :-variable expansion to psql \copy |