getting list of tables from command line

Поиск
Список
Период
Сортировка
От Craig White
Тема getting list of tables from command line
Дата
Msg-id 1193842901.27416.53.camel@lin-workstation.azapple.com
обсуждение исходный текст
Ответы Re: getting list of tables from command line  (Reece Hart <reece@harts.net>)
Re: getting list of tables from command line  ("T.J. Adami" <adamitj@gmail.com>)
Re: getting list of tables from command line  (David Fetter <david@fetter.org>)
Re: getting list of tables from command line  ("Filip Rembiałkowski" <plk.zuber@gmail.com>)
Re: getting list of tables from command line  (Ron St-Pierre <ron.pgsql@shaw.ca>)
Re: getting list of tables from command line  (hubert depesz lubaczewski <depesz@depesz.com>)
Список pgsql-general
I wrote a little script to individually back up table schemas, table
data and then vacuum the table and it works nicely but I wanted a way to
query a database and get a text file with just the table names and
cannot figure out a way to do that.

my script looks like this...
(all I want is to get a list of the tables into a text file pg_tables)

#/bin/sh
#
DB_NAME=whatever
#
for i in `cat pg_tables`
do
  pg_dump  --username=postgres \
    --schema=db
    --table=$i \
    --schema-only \
    $DB_NAME > schemas/$i.sql
  pg_dump  --username=postgres \
    --schema=db \
    --table=$i \
    --data-only \
    $DB_NAME > data/$i.sql
  vacuumdb --username=postgres \
   --dbname=$DB_NAME \
   --table=db.$i \
   --verbose \
   --full
done

Is there a way to do that?

Craig

PS there's a lack of cohesion between various commands such as vacuumdb
and pg_dump for things like '--schema'


В списке pgsql-general по дате отправления:

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: active connections
Следующее
От: Douglas McNaught
Дата:
Сообщение: Re: configure password