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

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2009-01-20 16:28:38 Re: import sql dump with psql - language creation throws error
Previous Message David Fetter 2009-01-20 15:44:06 Re: Database schema & data synchronizer software for PostgreSQL?