Re: databases list to file

From: "postgres Emanuel CALVO FRANCO" <postgres(dot)arg(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: databases list to file
Date: 2008-10-14 18:38:09
Message-ID: f205bb120810141138w1a1e7d57p13e2240eb1dddec8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

inside psql turn \o file
then \l

2008/10/9 Jeff Ross <jross(at)wykids(dot)org>:
> Joao Ferreira gmail wrote:
>>
>> Hello all,
>>
>> I need to print to a file a simple list of all the databases on my
>> postgresql.
>>
>> I need to do this from a shell script to be executed without human
>> intervention
>>
>> I guess something like:
>>
>> su postgres -c 'psql ...whatever.... > /tmp/my_databases.txt'
>>
>> but I don't know exactly to what extent I can format the output of this
>> in order to simplify the parser that will read that file.
>>
>> any suggestions ?
>>
>> thank you
>>
>> joao
>>
>>
>>
>
> psql -tc 'select datname from pg_database' template1
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mikkel Høgh 2008-10-14 18:39:33 Re: Drupal and PostgreSQL - performance issues?
Previous Message Bill Thoen 2008-10-14 18:36:33 Re: Update with a Repeating Sequence