Re: psql: Allow editing query results with \gedit

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: psql: Allow editing query results with \gedit
Дата
Msg-id CA+TgmoYgyUvbsbqTpp6FvHqpuE9sRsYbVtqQyirt975yc84gCw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: psql: Allow editing query results with \gedit  (Christoph Berg <myon@debian.org>)
Список pgsql-hackers
On Fri, May 17, 2024 at 9:24 AM Christoph Berg <myon@debian.org> wrote:
> Tom> The stated complaint was "it's too hard to build UPDATE commands",
> Tom> which I can sympathize with.
>
> ... which this would perfectly address - it's building the commands.
>
> The editor will have a bit more clutter (the UPDATE SET WHERE
> boilerplate), and the fields are somewhat out of order (the key at the
> end), but SQL commands are what people understand, and there is
> absolutely no ambiguity on what is going to be executed since the
> commands are exactly what is leaving the editor.

A point to consider is that the user can also do this in the query
itself, if desired. It'd just be a matter of assembling the query
string with appropriate calls to quote_literal() and quote_ident(),
which is not actually all that hard and I suspect many of us have done
that at one point or another. And then you know that you'll get the
right set of key columns and update the right table (as opposed to,
say, a view over the right table, or the wrong one out of several
tables that you joined).

Now you might say, well, that's not terribly convenient, which is
probably true, but this might be a case of -- convenient, reliable,
works with arbitrary queries -- pick two. I don't know. I wouldn't be
all that surprised if there's something clever and useful we could do
in this area, but I sure don't know what it is.

--
Robert Haas
EDB: http://www.enterprisedb.com



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

Предыдущее
От: Christoph Berg
Дата:
Сообщение: Re: psql JSON output format
Следующее
От: Joe Conway
Дата:
Сообщение: Re: commitfest.postgresql.org is no longer fit for purpose