Tab Completion for CREATE DATABASE ... TEMPLATE ... - Mailing list pgsql-hackers

From Sehrope Sarkuni
Subject Tab Completion for CREATE DATABASE ... TEMPLATE ...
Date
Msg-id CAH7T-arpQFxfSQFOiq4z1QU5vidy+CxfeA3ZWFngF42c_85+1Q@mail.gmail.com
Whole thread Raw
Responses Re: [REVIEW] Tab Completion for CREATE DATABASE ... TEMPLATE ...
List pgsql-hackers
We use "CREATE DATABASE foo TEMPLATE foo_bk" to restore development databases to a known snapshot (ex: prior to testing DB migrations). Currently psql only autocompletes "foo_bk" if it's marked as a template database. It's mildly inconvenient to have to type out the entire database name (as they're not marked as templates).

The CREATE DATABASE command allows a super user to use any database as the template, and a non-super user (with CREATEDB privilege) to use any database of which it's the owner.

The attached patch updates the psql "CREATE DATABASE ... TEMPLATE <tab>" completion to match what the command actually allows.

Regards,
-- Sehrope Sarkuni
Founder & CEO | JackDB, Inc. | https://www.jackdb.com/

Attachment

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: proposal: PL/Pythonu - function ereport
Next
From: Bruce Momjian
Date:
Subject: Re: PostgreSQL Audit Extension