psql tab completion for CREATE DATABASE ... LOCALE

Started by Ian Lawrence Barwickalmost 5 years ago3 messages
#1Ian Lawrence Barwick
barwick@gmail.com
1 attachment(s)

Greetings

This morning I was overcome by an urge to create a database with a specific
locale, and my insufficiently caffeinated brain reminded me there was a
handy
LOCALE option added not so long ago, but was confused by its stubborn
absence
from the list of tab completion options presented by psql on a current HEAD
build, no matter how much I mashed the tab key.

Further investigation confirmed the LOCALE option was added in PostgreSQL 13
(commit 06140c20) but neither commit [1]https://git.postgresql.org/pg/commitdiff/06140c201b982436974d71e756d7331767a41e57 nor discussion [2]/messages/by-id/d9d5043a-dc70-da8a-0166-1e218e6e34d4@2ndquadrant.com mention psql.
Trivialest of trivial patches attached (will add to next CF).

[1]: https://git.postgresql.org/pg/commitdiff/06140c201b982436974d71e756d7331767a41e57
https://git.postgresql.org/pg/commitdiff/06140c201b982436974d71e756d7331767a41e57
[2]: /messages/by-id/d9d5043a-dc70-da8a-0166-1e218e6e34d4@2ndquadrant.com
/messages/by-id/d9d5043a-dc70-da8a-0166-1e218e6e34d4@2ndquadrant.com

Regards

Ian Barwick

--
EnterpriseDB: https://www.enterprisedb.com

Attachments:

psql-create-database-locale.v1.difftext/x-patch; charset=US-ASCII; name=psql-create-database-locale.v1.diffDownload
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index a75647b1cc..5f0e775fd3 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2429,7 +2429,7 @@ psql_completion(const char *text, int start, int end)
 		COMPLETE_WITH("OWNER", "TEMPLATE", "ENCODING", "TABLESPACE",
 					  "IS_TEMPLATE",
 					  "ALLOW_CONNECTIONS", "CONNECTION LIMIT",
-					  "LC_COLLATE", "LC_CTYPE");
+					  "LC_COLLATE", "LC_CTYPE", "LOCALE");
 
 	else if (Matches("CREATE", "DATABASE", MatchAny, "TEMPLATE"))
 		COMPLETE_WITH_QUERY(Query_for_list_of_template_databases);
#2Thomas Munro
thomas.munro@gmail.com
In reply to: Ian Lawrence Barwick (#1)
Re: psql tab completion for CREATE DATABASE ... LOCALE

On Fri, Feb 5, 2021 at 2:40 PM Ian Lawrence Barwick <barwick@gmail.com> wrote:

Trivialest of trivial patches attached (will add to next CF).

Thanks, pushed.

#3Ian Lawrence Barwick
barwick@gmail.com
In reply to: Thomas Munro (#2)
Re: psql tab completion for CREATE DATABASE ... LOCALE

2021年2月5日(金) 11:51 Thomas Munro <thomas.munro@gmail.com>:

On Fri, Feb 5, 2021 at 2:40 PM Ian Lawrence Barwick <barwick@gmail.com>
wrote:

Trivialest of trivial patches attached (will add to next CF).

Thanks, pushed.

Oh, that was quick, thanks! I hadn't even got round to adding it to the CF.

Regards

Ian Barwick
--
EnterpriseDB: https://www.enterprisedb.com