RE: Add partial :-variable expansion to psql \copy

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема RE: Add partial :-variable expansion to psql \copy
Дата
Msg-id PR0P264MB43009A918E17B5E7B93BB900ABAD2@PR0P264MB4300.FRAP264.PROD.OUTLOOK.COM
обсуждение исходный текст
Ответ на Add partial :-variable expansion to psql \copy  (Fabien COELHO <coelho@cri.ensmp.fr>)
Список pgsql-hackers
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.
Вложения

В списке pgsql-hackers по дате отправления: