From: | Fabien Coelho <coelho(at)cri(dot)ensmp(dot)fr> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Add partial :-variable expansion to psql \copy |
Date: | 2025-04-16 07:40:52 |
Message-ID: | 431219fa-c2e5-428c-b41e-644a70388c1a@cri.ensmp.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
Here is a rebased and updated version of adding \gi:
- improved documentation
- some refactoring to share one function
- signal trap disabled on \gi as well
The thread subject is now a misnomer, I'm not sure whether I should
update it or start a new thread.
On 05/04/2025 22:14, Fabien Coelho wrote:
> Hello Tom and Corey,
>
>> [...] Anyway, my feeling about it is that \copy parsing is a huge hack
>> right now, and I'd rather see it become less of a hack, that is
>> more like other psql commands, instead of getting even hackier.
>
> After giving it some thoughts, I concluded that trying to salvage
> \copy is not the
> way to go and I have followed Corey's suggestion to extend the
> standard SQL COPY
> handling by providing an alternate input stream with "\gi file" or
> "\gi cmd|".
>
> This has lead to significant restructuring so as to simplify \copy
> handling to use
> the \g and \gi existing infrastructure. I've moved checked performed
> only for \copy
> so that they are now also done with \g, and error messages are more
> systematically
> shown. The pipe char used to mark a command instead of a file is
> switched to a
> boolean, which is more consistent with other places and how it can be
> managed with
> "\gi command|" as the pipe char is at the end instead of the start.
> The patch also
> includes tests and some doc.
>
> If this is accepted, ISTM that \copy could be retired and even removed
> at a
> later stage, which would solve elegantly its debatable implementation.
>
--
Fabien.
Attachment | Content-Type | Size |
---|---|---|
psql-copy-var-3.patch | text/x-patch | 26.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Banck | 2025-04-16 07:50:45 | Re: Built-in Raft replication |
Previous Message | Andrei Lepikhov | 2025-04-16 07:28:31 | Re: A modest proposal: make parser/rewriter/planner inputs read-only |