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

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Add partial :-variable expansion to psql \copy
Дата
Msg-id CAFj8pRBNgnxCuSuUGm_Mad4RwCMCQ6SBC8v3t9qz5rqXTJTqRg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Add partial :-variable expansion to psql \copy  (Christoph Berg <myon@debian.org>)
Список pgsql-hackers
Hi

út 1. 4. 2025 v 12:00 odesílatel Christoph Berg <myon@debian.org> napsal:
Re: Fabien Coelho
> (1) it seems that is the only command which is really full SQL hidden in a
> backslash command

Perhaps this form could be improved by changing `\copy (select) to file`
to something like `select \gcopy (to file)`. That might make :expansion
in the "select" part easier to handle.

I've heard several complaints that `\copy (select)` can't be wrapped
over several lines, so offering the alternative syntax in parallel to
\copy would also solve another problem.

What is the reason to use \copy (select) to ?

psql (on client side) supports csv format pretty well with single line switching to this format (i know so it not have the full functionality of COPY statement).

(2025-04-01 12:08:36) postgres=# select 1,2 \g (format=csv) output.csv
(2025-04-01 12:08:53) postgres=#

For me, the original proposal has interesting benefits (Tom wrote about it). Inconsistency where psql's variable can or cannot be used is unhappy. It is always bad surprising when you find some inconsistencies

Regards

Pavel
 

Christoph


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