Re: psql: Allow editing query results with \gedit

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Christoph Berg <myon(at)debian(dot)org>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: psql: Allow editing query results with \gedit
Date: 2024-01-23 17:13:32
Message-ID: CAFj8pRA_MOFY8cHOgnVkJqLhxFrg40a6Jg-MTN_XaBu_oMA30w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

út 23. 1. 2024 v 11:38 odesílatel Christoph Berg <myon(at)debian(dot)org> napsal:

> Re: Pavel Stehule
> > It looks great for simple queries, but if somebody uses it like SELECT *
> > FROM pg_proc \gedit
>
> What's wrong with that? If the pager can handle the amount of data,
> the editor can do that as well. (If not, the fix is to just not run
> the command, and not blame the feature.)
>

just editing wide or long command or extra long strings can be unfriendly

>
> > I almost sure so \gedit is wrong name for this feature.
>
> I'm open for suggestions.
>

I have not too many ideas. The problem is in missing relation between
"edit" and "update and execute"

>
> > Can be nice if we are able:
> >
> > a) export data set in some readable format
> >
> > b) be possible to use more command in pipes
> >
> > some like
> >
> > select start, call, qrg, name from log where cty = 'CE9' order by start
> > \gpipexec(tsv) mypipe | bash update_pattern.sh > tmpfile; vi tmpfile; cat
> > tmpfile > mypipe
>
> Well yeah, that's still a lot of typing.
>

it should not be problem. You can hide long strings to psql variables

>
> > I understand your motivation well, but I don't like your proposal because
> > too many different things are pushed to one feature, and it is designed
> for
> > a single purpose.
>
> It's one feature for one purpose. And the patch isn't *that* huge. Did
> I make the mistake of adding documentation, extra command options, and
> tab completion in v1?
>

no - I have problem so one command does editing, generating write SQL
commands (updates) and their execution

>
> Christoph
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-01-23 17:28:18 Re: core dumps in auto_prewarm, tests succeed
Previous Message Christoph Berg 2024-01-23 16:35:01 Re: psql JSON output format