Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oNx9q-0005UB-Kw for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2022 14:03:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oNx9p-00060S-Az for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2022 14:03:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oNx9o-00060J-WA for pgsql-general@lists.postgresql.org; Tue, 16 Aug 2022 14:03:01 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oNx9i-0001SB-Jr for pgsql-general@lists.postgresql.org; Tue, 16 Aug 2022 14:03:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=BvyyK6JGrInb8ix+kaMPlNH7Y6ROOHxmV4mrCwYuc5M=; b=ITAsnje+hp0fsjqCruPOT14yia Nf+hSJNJ+qN+IxWwuYHuloeL7cB0rppWIqOkKaJ33JG3fF3VU+1xhzOu8HsQgm1qtFV7flr1HRxvq nme2xbe5nk94TOvHzfUzaYYokOQCq6dK4spKwELoD6/pNiN5sw5HE5sHleGqP/Rjs/fw=; Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by depesz.com with esmtpa (Exim 4.92) (envelope-from ) id 1oNx9h-00050a-S4; Tue, 16 Aug 2022 16:02:53 +0200 Date: Tue, 16 Aug 2022 16:02:53 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Ron Cc: pgsql-general@lists.postgresql.org Subject: Re: Would it be possible to add functions to tab-completion in psql? Message-ID: <20220816140253.GB14225@depesz.com> Reply-To: depesz@depesz.com References: <20220816122849.GC24417@depesz.com> <20220816130114.GA22122@depesz.com> <2bdacb77-c22f-8be5-cbb7-418c1e3eab82@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2bdacb77-c22f-8be5-cbb7-418c1e3eab82@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Aug 16, 2022 at 08:51:49AM -0500, Ron wrote: > On 8/16/22 08:01, hubert depesz lubaczewski wrote: > > On Tue, Aug 16, 2022 at 07:42:27AM -0500, Ron wrote: > > > On 8/16/22 07:28, hubert depesz lubaczewski wrote: > > > > Hi, > > > > As a dba I have to, very often, query system functions, starting with > > > > pg_last_xact_replay_timestamp and pg_current_wal_lsn. > > > > > > > > Would it be possible/hard/expensive, to change tab-completion so that: > > > > > > > > select pg_ would work? > > > It does, in the psql 9.6 and 12 that I installed from it's native > > > repositories, and the psql 12 installed from RHEL 7/8 native repositories. > > Hmm .. I'm on Pg 16, linked with readline, and pressing tab after > > Pg *16*?? Yes. I use dev pg on daily basis. > > select pg_ > > just produces new prompt: > > > > https://asciinema.org/a/A8w16KhXF7bK4iz7hE7iyyo0D > > > > Can you please show me this working, with "which psql", and "ldd $( > > which psql )" using asciinema? > > $ alias psql12 > alias psql12='/usr/lib/postgresql/12/bin/psql -p5433' > > $ psql12 > psql (12.11 (Ubuntu 12.11-1.pgdg18.04+1)) > Type "help" for help. > > postgres=# select * from pg_ > Display all 130 possibilities? (y or n) Please note that this example is not really relevant to what I asked about. First of all, I asked about `select pg_`, and not `select * from pg_`, second this tab completion lists tables and views that have names starting with pg_*. And I asked about functions. I know we can tab-complete relations. But we can't functions. Best regards, depesz