psql tab-complete and backslash patch

Started by Stefan Kaltenbrunnerabout 21 years ago4 messagespatches
Jump to latest
#1Stefan Kaltenbrunner
stefan@kaltenbrunner.cc

Hi!

attached is a patch against psql that makes psql's tabcomplete code
ROLES aware, adds SET SCHEMA and basic CREATE DATABASE/TRIGGER support
as well as some other minor things.
In addition to this I modified \du to display a list of roles with some
additional information(createrole,connection limit) on 8.1 with a
fallback to the original output on older backends.

There are a few problems still left - in particular the the tab-complete
code is a little inconsistent wrt completing USER/ROLE/GROUP/OWNER TO
with roles or users/groups (from the pg_user/pg_group views)

comments(especially about the \du change)?

regards

Stefan Kaltenbrunner

Changes in Detail:

*) SET SCHEMA for ALTER AGGREGATE,FUNCTION.DOMAIN,SEQUENCE,TABLE,TYPE
*) add CONNECTION LIMIT to ALTER DATABASE
*) add support for ALTER ROLE
*) make ALTER USER aware about ROLES
*) COMMENT ON LARGE OBJECT
*) add support for CREATE DATABASE
*) add support for CREATE TRIGGER
*) add support for CREATE USER,ROLE,GROUP
*) complete SET ROLE with a list of roles
*) complete SET SCHEMA with a list of schemas
*) complete SET SESSION AUTHORIZATION with list of roles
*) fixes a small typo in a comment (ANALZYE -> ANALYZE)
*) modify \du to display createrole and the connection limit

Attachments:

tab-complete-roles.difftext/plain; name=tab-complete-roles.diffDownload+171-37
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Stefan Kaltenbrunner (#1)
Re: psql tab-complete and backslash patch

Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:

attached is a patch against psql that makes psql's tabcomplete code
ROLES aware, adds SET SCHEMA and basic CREATE DATABASE/TRIGGER support
as well as some other minor things.

Applied with some changes. I didn't see the point of making \du
backwards compatible to older versions; we've never worried about that
before in psql's \d commands. Also I thought the "Attributes" approach
of the old \du code was well past its usefulness, so I just changed it
to separate columns.

regards, tom lane

#3Stefan Kaltenbrunner
stefan@kaltenbrunner.cc
In reply to: Tom Lane (#2)
Re: psql tab-complete and backslash patch

Tom Lane wrote:

Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:

attached is a patch against psql that makes psql's tabcomplete code
ROLES aware, adds SET SCHEMA and basic CREATE DATABASE/TRIGGER support
as well as some other minor things.

Applied with some changes. I didn't see the point of making \du
backwards compatible to older versions; we've never worried about that
before in psql's \d commands. Also I thought the "Attributes" approach
of the old \du code was well past its usefulness, so I just changed it
to separate columns.

thanks for applying!
While I know that we have never guaranteed backwards-compatibility for
psql's backslash commands (or for tab-complete either) I modeled this
after the \db-tablespace code. Removing it altogether is fine too :-)
Any particular reason why you dropped the SET SCHEMA <tab> part of my
patch ?

Stefan

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Stefan Kaltenbrunner (#3)
Re: psql tab-complete and backslash patch

Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:

Any particular reason why you dropped the SET SCHEMA <tab> part of my
patch ?

Because we have no such command.

regards, tom lane