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

From Andreas Wenk
Subject Re: import sql dump with psql - language creation throws error
Date
Msg-id 4975F2E2.3090206@netzmeister-st-pauli.de
Whole thread Raw
In response to Re: import sql dump with psql - language creation throws error  (Adrian Klaver <aklaver@comcast.net>)
Responses Re: import sql dump with psql - language creation throws error  (Adrian Klaver <aklaver@comcast.net>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Adrian Klaver schrieb:
> On Tuesday 20 January 2009 7:05:23 am Andreas Wenk wrote:
>
>> Adrian,
>>
>> no lack of coffee but my fault. You are totally right - that was a copy and
>> paste error. For sure the dump is *.sql.
>>
>> Until now there is no onboard solution for this issue. Means, the import of
>> the dump is working correct but a "message" is thrown: FEHLER:  Sprache
>> »plpgsql« existiert bereits (means ERROR: Language »plpgsql« allready
>> exists). What I do now - and this is not really beautiful - is to erase
>> that "message" before oputput is created from the shell script:
>>
>> psql -o /dev/null $DB < /var/lib/postgresql/scripts/$SQL_DUMP  2>&1 | grep
>> -v "FEHLER: Sprache »plpgsql« existiert bereits"
>> exit 0
>>
>> Now, no output from the script is catched by the crondaemon and no email is
>> sent. On the other hand, no error from the above line is catched at all ...
>> unfortunately ...
>>
>> By the way - language plpgsql was created with createlang plpgsql
>> template1. And because of tsearch2 it's not possible to create the db from
>> template0.
>>
>> Got another idea?
>>
>> Cheers
>>
>> Andy
>
>
> Just to point you to Grzegorz's suggestion of using the  -c switch in the
> pg_dump command. To quote the manual:
>
> -c
> "Output commands to clean (drop) database objects prior to (the commands for)
> creating them.
>  This option is only meaningful for the plain-text format. For the archive
> formats, you can specify the option when you call pg_restore. "
>

I allready tried -c ... it's not what I need or helps - thanks anyway ;-)

> Also I am not sure cron sending the email is a bad thing. Serves as indicator
> that the process ran.
>

Yes that's correct ... in a way - but imagine you have 20 cronjobs running - do you really
want to spam your mailbox with these messages? I think the better way is to leave it
running and only in case of an error inform me. I think this is the common way sysadmins
are doing it ...

Cheers

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

iD8DBQFJdfLiVa7znmSP9AwRAqYlAKCONfrcirRuDzFYYs9+1Sbg46JejgCgif0V
2RMlNbRaqK7aAomCk6tzPow=
=+whp
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: David Fetter
Date:
Subject: Re: Database schema & data synchronizer software for PostgreSQL?
Next
From: Adrian Klaver
Date:
Subject: Re: import sql dump with psql - language creation throws error