Re: import sql dump with psql - language creation throws error

From: Adrian Klaver <aklaver(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: Andreas Wenk <a(dot)wenk(at)netzmeister-st-pauli(dot)de>
Subject: Re: import sql dump with psql - language creation throws error
Date: 2009-01-20 14:52:45
Message-ID: 200901200652.45790.aklaver@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 20 January 2009 2:15:08 am Andreas Wenk wrote:
> Hi everybody,
>
> I have an automated mechanism to restore a demo database each night with an
> SQL dump. What I do inbetween a shell script is the following:
>
> 1. all database access is canceled
> 2. dropdb
> 3. createdb
> 4. import SQL dump: psql -o /dev/null $DB <
> /var/lib/postgresql/scripts/$SQL_DUMP
>
> The last step is the issue. The shell script is run by an cronjob and if
> one of the steps is failing, the crondaemon sends an E-Mail. The cluster
> allready exists (for sure) and the language plpgsl also. The last point
> (4.) always creates an error (what is clear), allthough the dump is
> imported anyway:
>
> ERROR: Language »plpgsql« allready exists
>
> psql -o /dev/null $DB < /var/lib/postgresql/scripts/$SQL_DUMP ||
> echo "Der dump konnte nicht eingespielt werden." >&2
>
> And because the ERROR message is the output, the crondaemon sends an email.
>
> Question:
>
> Where can I prevent bulding the language again? My idea was to do that
> while creating the dump or while importing the dump. But as far as I
> understand, that's not possible.
>
> The dump is created on another server using
> /usr/bin/pg_dump -Ft -t sys_language garfield > sys_language.tar

Could be lack of coffee, but I am somewhat confused. Is this indeed the dump
file you are restoring? I didn't think you could restore a tar dump with psql.
Also you are only dumping one table, so I am not sure why the whole db is being
recreated.

>
> Thanks for any advice
>
> Andy
>
> --
> Andreas Wenk
>
> St.Pauli - Hamburg - Germany

--
Adrian Klaver
aklaver(at)comcast(dot)net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Wenk 2009-01-20 15:05:23 Re: import sql dump with psql - language creation throws error
Previous Message Csaba Együd 2009-01-20 14:03:33 Database schema & data synchronizer software for PostgreSQL?