Re: [HACKERS] Feature request: make cluster_name GUC useful for psql prompts

2016-05-06 Thread Steve Crawford
Although this is getting slightly off the original topic, rereading .psqlrc is a potential can of worms. What triggers a reread? What portions of .psqlrc are re-read? For example, say I have just set tuples-only, extended-display, or output file. Would they all get reset just because I changed con

Re: [HACKERS] Feature request: make cluster_name GUC useful for psql prompts

2016-05-06 Thread Alvaro Herrera
Jerry Sievers wrote: > Steve Crawford writes: > > > That is almost identical to the solution I suggested a week or two ago to > > someone tackling the issue and the hack works on initial connection. > > > > Connect to a different cluster with "\c", however, and it will leave the > > prompt show

Re: [HACKERS] Feature request: make cluster_name GUC useful for psql prompts

2016-05-06 Thread Jerry Sievers
Steve Crawford writes: > That is almost identical to the solution I suggested a week or two ago to > someone tackling the issue and the hack works on initial connection. > > Connect to a different cluster with "\c", however, and it will leave the > prompt showing you connected to the original d

Re: [HACKERS] Feature request: make cluster_name GUC useful for psql prompts

2016-05-06 Thread Steve Crawford
That is almost identical to the solution I suggested a week or two ago to someone tackling the issue and the hack works on initial connection. Connect to a different cluster with "\c", however, and it will leave the prompt showing you connected to the original database which is not good. Cheers,

Re: [HACKERS] Feature request: make cluster_name GUC useful for psql prompts

2016-05-06 Thread Jerry Sievers
Peter Eisentraut writes: > On 5/5/16 9:21 PM, Steve Crawford wrote: > >> Adding an escape sequence that references cluster_name would enable >> prompts to identify the cluster in a manner that is both consistent and >> distinct regardless of access path. > > I think that would be a good idea. Yo

Re: [HACKERS] Feature request: make cluster_name GUC useful for psql prompts

2016-05-06 Thread Peter Eisentraut
On 5/5/16 9:21 PM, Steve Crawford wrote: Adding an escape sequence that references cluster_name would enable prompts to identify the cluster in a manner that is both consistent and distinct regardless of access path. I think that would be a good idea. You could probably design it so that any

[HACKERS] Feature request: make cluster_name GUC useful for psql prompts

2016-05-05 Thread Steve Crawford
It's great that 9.5 has the new cluster_name variable as an available GUC. It would be even better to make that GUC available for use in psql prompting escape sequences. Prompting via sequences utilizing %M, %m and %> means the same cluster could be identified numerous ways (local, 127.0.0.1, 10.