Re: [PROPOSAL] Make PSQLVAR on \getenv opitional

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: [PROPOSAL] Make PSQLVAR on \getenv opitional
Дата
Msg-id CAFj8pRDKSVpU2+b9ZPvP+xHsyoV-J=krrsX3U5CYzmw7H_zE1w@mail.gmail.com
обсуждение исходный текст
Ответ на [PROPOSAL] Make PSQLVAR on \getenv opitional  (Matheus Alcantara <msalcantara.dev@pm.me>)
Ответы Re: [PROPOSAL] Make PSQLVAR on \getenv opitional  (Matheus Alcantara <msalcantara.dev@pm.me>)
Re: [PROPOSAL] Make PSQLVAR on \getenv opitional  (Christoph Moench-Tegeder <cmt@burggraben.net>)
Список pgsql-hackers


út 28. 12. 2021 v 19:51 odesílatel Matheus Alcantara <msalcantara.dev@pm.me> napsal:
Hi pgsql hackers, I was testing the new psql command \getenv introduced on commit 33d3eeadb2 and from a user perspective, I think that would be nice if the PSQLVAR parameter were optional, therefore when it is only necessary to view the value of the environment variable, the user just run \getenv, for example:

\getenv PATH
/usr/local/sbin:/usr/local/bin:/usr/bin

And when it is necessary to assign the environment variable in a variable, the user could execute like this:

\getenv PATH myvar
\echo :myvar
/usr/local/sbin:/usr/local/bin:/usr/bin

For this flexibility the order of parameters would need to be reversed, instead of \getenv PSQLVAR ENVVAR would be \getenv ENVVAR PSQLVAR.

What do you guys think? I'm not a C expert but if this proposal is interesting I can write a patch.

it is not consistent with other \g* commands. Maybe a new statement \senv ?  But what is the use case? You can just press ^z and inside shell write echo $xxx, and then fg

Regards

Pavel


This is my first time sending an email here, so let me know if I doing something wrong.



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

Предыдущее
От: Matheus Alcantara
Дата:
Сообщение: [PROPOSAL] Make PSQLVAR on \getenv opitional
Следующее
От: Matheus Alcantara
Дата:
Сообщение: Re: [PROPOSAL] Make PSQLVAR on \getenv opitional