Search Postgresql Archives

Re: databases list to file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



inside psql turn \o file
then \l



2008/10/9 Jeff Ross <jross@xxxxxxxxxx>:
> 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@xxxxxxxxxxxxxx)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux