import sql dump with psql - language creation throws error - Mailing list pgsql-general

From Andreas Wenk
Subject import sql dump with psql - language creation throws error
Date
Msg-id 4975A42C.9010201@netzmeister-st-pauli.de
Whole thread Raw
Responses Re: import sql dump with psql - language creation throws error  (hubert depesz lubaczewski <depesz@depesz.com>)
Re: import sql dump with psql - language creation throws error  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Re: import sql dump with psql - language creation throws error  (Adrian Klaver <aklaver@comcast.net>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

Thanks for any advice

Andy

- --
Andreas Wenk

St.Pauli - Hamburg - Germany
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJdaQsVa7znmSP9AwRAlE0AKCVTqsD9X8nMtGHcTsfzHVElK5ePQCeMC3c
vqOqVcx0ns26Nf8esi4xp/A=
=zDAD
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: Kristian Klette via RT
Date:
Subject: Recovering from database corruption using WAL-logs
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: import sql dump with psql - language creation throws error