Re: I need to take metadata from a shell script.

From: Scott Mead <scott(dot)lists(at)enterprisedb(dot)com>
To: Jaume Calm <jaume(at)isac(dot)cat>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: I need to take metadata from a shell script.
Date: 2010-05-06 15:13:36
Message-ID: n2yd3ab2ec81005060813z922572e5x71984b85de78b600@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, May 6, 2010 at 3:57 AM, Jaume Calm <jaume(at)isac(dot)cat> wrote:

> Hi! I was searching for a command like pg_dumpall but with the difference
> that I don’t want a single file for all databases, i would like to have a
> file for each one.
>
>
>
> I couldn’t fins such command, so the only option I see is to write a shell
> script with a loop for all the DBs. The problem is that I’m unable to find
> the way to obtain the DBs’ names in a shell script. Can someone help me with
> this?
>

for line in `psql -t postgres -c "select datname from pg_database" `; do
printf "$line\n"; done

--Scott

>
>
> Best regards and thank you all for your time.
>
>
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andy Colson 2010-05-06 15:15:57 Re: I need to take metadata from a shell script.
Previous Message Thom Brown 2010-05-06 15:11:56 Re: I need to take metadata from a shell script.