Re: getting list of tables from command line

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: getting list of tables from command line
Дата
Msg-id 20071031171350.GG10414@fetter.org
обсуждение исходный текст
Ответ на getting list of tables from command line  (Craig White <craigwhite@azapple.com>)
Список pgsql-general
On Wed, Oct 31, 2007 at 08:01:41AM -0700, Craig White wrote:
> 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.

This should do it. :)

psql -At your_db <<EOT > pg_tables
SELECT quote_ident(table_schema) || '.' || quote_ident(table_name)
FROM information_schema.tables
WHERE
    table_schema NOT IN (
        'information_schema',
        'pg_catalog'
    )
AND
    table_type = 'BASE TABLE';
EOT

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

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

Предыдущее
От: "T.J. Adami"
Дата:
Сообщение: Re: Replacing RDBMS
Следующее
От: João Paulo Zavanela
Дата:
Сообщение: Re: Install plJava