Tab Completion for CREATE DATABASE ... TEMPLATE ...

From: Sehrope Sarkuni <sehrope(at)jackdb(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Tab Completion for CREATE DATABASE ... TEMPLATE ...
Date: 2016-02-16 23:40:29
Message-ID: CAH7T-arpQFxfSQFOiq4z1QU5vidy+CxfeA3ZWFngF42c_85+1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: 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 Content-Type Size
tab-complete-create-database-template.patch text/x-patch 954 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2016-02-16 23:50:41 Re: PostgreSQL Audit Extension
Previous Message Pavel Stehule 2016-02-16 21:58:51 Re: proposal: PL/Pythonu - function ereport