From b9deb848411df477458d398d367ecd29e6828862 Mon Sep 17 00:00:00 2001 From: ianmacd <> Date: Mon, 23 Jun 2003 13:54:01 +0000 Subject: [PATCH] - psql update from Guillaume Rousse --- bash_completion | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bash_completion b/bash_completion index d1497626..5fe0a732 100644 --- a/bash_completion +++ b/bash_completion @@ -1,6 +1,6 @@ # bash_completion - some programmable completion functions for bash 2.05b # -# $Id: bash_completion,v 1.582 2003/06/23 15:39:59 ianmacd Exp $ +# $Id: bash_completion,v 1.583 2003/06/23 15:54:01 ianmacd Exp $ # # Copyright (C) Ian Macdonald # @@ -2815,12 +2815,13 @@ have psql && { _pg_databases() { COMPREPLY=( $( psql -l 2>/dev/null | \ - sed -ne 's|^ \('$cur'[^ ]*\).*$|\1|p' ) ) + sed -e '1,/^-/d' -e '/^(/,$d' | \ + awk '{print $1}' | grep "^$cur" ) ) } _pg_users() { - COMPREPLY=( $( psql -qtc 'select usename from pg_user' 2>/dev/null | \ + COMPREPLY=( $( psql -qtc 'select usename from pg_user' template1 2>/dev/null | \ grep "^ $cur" ) ) [ ${#COMPREPLY[@]} -eq 0 ] && COMPREPLY=( $( compgen -u -- $cur ) ) }