Feature request: make cluster_name GUC useful for psql prompts

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Feature request: make cluster_name GUC useful for psql prompts
Date: 2016-05-06 01:21:18
Message-ID: CAEfWYyyeN3x+6qFJaCv64wpKw3SbwZ7XEdW_nhU3yjiuYyuNFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.1.2.3, localhost,
myserver.example.com, myserver, etc.) which is further exacerbated when
pooling or port-forwarding is in play.

In the inverse case, when logging into a multiple servers and running psql,
all the prompts might just say "local" despite all being different clusters.

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.

Potential issues/improvements:

What should the escape-sequence display if cluster_name is not set or the
cluster is a pre-9.5 version. %M? %m?

In future server versions should there be a default for cluster_name if it
is not set? If so, what should it be? Would the server canonical hostname +
listen-port be reasonable?

Cheers,
Steve

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-05-06 01:36:05 Re: Initial release notes created for 9.6
Previous Message Masahiko Sawada 2016-05-06 01:21:11 Re: Initial release notes created for 9.6