Re: [Patch] New psql prompt substitution %r (m = master, r = replica)

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: [Patch] New psql prompt substitution %r (m = master, r = replica)
Дата
Msg-id 20160818013620.GA927541@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: [Patch] New psql prompt substitution %r (m = master, r = replica)  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
Ответы Re: [Patch] New psql prompt substitution %r (m = master, r = replica)  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
Список pgsql-hackers
Aleksander Alekseev wrote:

> $ cat ~/.psqlrc 
> select (case when pg_is_in_recovery() then 'r' else 'm' end) as mor
> \gset
> 
> \set PROMPT1 '%p (%:mor:) =# '

Okay, this seems moderately reasonable, but ...

> Besides I figured out that replica promotion case could also be properly
> handled without any patches. In case anyone is interested here is a
> brief description of a solution.
> 
> ~/.bash_profile:

... this is terrible.  Not only because it's a lot of code dependent on
an external tool which will be rather heavyhanded for something that
should probably be very lightweight, but also because the code itself is
(no offense) an unreadable mess.

I think your general idea for the feature is a good one, even if the
patch you submitted isn't a good implementation.  Not sure a real one
is worth the effort, though.  I don't think Peter's comment that more
roles than master/replica are possible is a showstopper: that's already
going to be an issue for things like ALTER TRIGGER ENABLE REPLICA and
the like, I suppose.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Pluggable storage
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Anyone want to update our Windows timezone map?