Add _pgsql_schemas to grab the list of schemas for pg_dump.

This commit is contained in:
J Smith 2012-09-10 16:36:27 -04:00
parent 5921809d49
commit bc8ef15557
1 changed files with 18 additions and 1 deletions

View File

@ -96,6 +96,23 @@ _pgsql_tables () {
$( psql $_pgsql_params[@] -Aqt -c $_pgsql_table_sql $db 2>/dev/null )
}
_pgsql_schemas () {
local _pgsql_user _pgsql_port _pgsql_host _pgsql_params
_pgsql_get_identity
local db
db=${line[1]:-${PGDATABASE:-$LOGNAME}}
local _pgsql_schema_sql="select n.nspname \
from pg_catalog.pg_namespace n \
where n.nspname !~ '^pg_' \
and n.nspname <> 'information_schema' \
order by 1;"
compadd "$@" - \
$( psql $_pgsql_params[@] -Aqt -c $_pgsql_schema_sql $db 2>/dev/null )
}
_pgsql_databases () {
local _pgsql_user _pgsql_port _pgsql_host _pgsql_params
_pgsql_get_identity
@ -171,7 +188,7 @@ _pg_dump () {
{-f+,--file=}':output file:_files' \
{-F+,--format=}':output format:_values "format" "p[plain text]" "t[tar]" "c[custom]"' \
{-i,--ignore-version}'[ignore version mismatch]' \
{-n+,--schema=}':schema to dump:' \
{-n+,--schema=}':schema to dump:_pgsql_schemas' \
{-o,--oids}'[dump objects identifiers for every table]' \
{-O,--no-owner}'[dont recreate as same owner]' \
{-R,--no-reconnect}'[dont output connect]' \