Обсуждение: problem with pg_dump

Поиск
Список
Период
Сортировка

problem with pg_dump

От
Jonatan Reiners
Дата:
Dear Supporters,
i tried to import a pg_dump file.
This gave me a few errors.

Functions were restored without the corresponding tables created (they were created later in process). This resulted in errors.
There were similar error with the wrong sequence of creation.

As a result I can't see that pg_dump creates a valid dump file neither is capable of creating reliable backups.

Am I wrong?

Further information will be provided if necessary.

-- 
Jonatan Reiners

Re: problem with pg_dump

От
Tom Lane
Дата:
Jonatan Reiners <jreiners@encc.de> writes:
> i tried to import a pg_dump file.
> This gave me a few errors.

> Functions were restored without the corresponding tables created (they were created later in process). This resulted
inerrors. 
> There were similar error with the wrong sequence of creation.

What PG version are you using?  Can you provide a concrete example
of a database that's dumped incorrectly?

http://wiki.postgresql.org/wiki/Guide_to_reporting_problems

            regards, tom lane

Re: problem with pg_dump

От
Jonatan Reiners
Дата:
First, thanks for that link, i was ignorant.

Process used: 

Export database with 'pg_dump icon > save.sql' ( from Mac OS X, pg 9.1.4 )

Import database with 'psql icon < save.sql ( onto Ubuntu, pg 9.1.4 )

The old problem vanished after an update on mac os from 9.1.3 to 9.1.4.

Another problem with tables with money values emerged.

Log excerp:
ERROR:  invalid input syntax for type money: "Eu67.667,00"
CONTEXT:  COPY bank_transactions, line 1, column amount: "Eu67.667,00"

Similar errors for all tables with money column.

Any hint or suggestions?

Kind regards and thanks for your precious help.

Jonatan

-- 
Jonatan Reiners

Am Freitag, 27. Juli 2012 um 18:22 schrieb Tom Lane:


Re: problem with pg_dump

От
Thomas Kellerer
Дата:
Jonatan Reiners, 31.07.2012 12:06:
> First, thanks for that link, i was ignorant.
>
> Process used:
>
> Export database with 'pg_dump icon > save.sql' ( from Mac OS X, pg 9.1.4 )
>
> Import database with 'psql icon < save.sql ( onto Ubuntu, pg 9.1.4 )
>
> The old problem vanished after an update on mac os from 9.1.3 to 9.1.4.
>
> Another problem with tables with money values emerged.
>
> Log excerp:
> ERROR:  invalid input syntax for type money: "Eu67.667,00"
> CONTEXT:  COPY bank_transactions, line 1, column amount: "Eu67.667,00"
>
> Similar errors for all tables with money column.
>
> Any hint or suggestions?
>
> Kind regards and thanks for your precious help.
>
> Jonatan

Sounds like you have different setting for for lc_monetary on the target than on the source.

Make sure both are set to the same value (in postgresql.conf)

That's one of the reasons I don't like the money datatype.
I prefer to store that in a regular numeric column and have the currency in another one

Thomas



Re: problem with pg_dump

От
Jonatan Reiners
Дата:
Both are set to lc_monetary = 'de_DE.UTF-8'
Maybe they mean something different on both OSs or one installation is faulty and ignores this setting.

I think I will go the way and convert the value to numeric.

unfortunately this doesn't work
alter table bst alter summe set data type numeric(30,2) using summe::numeric;
Looks nice but:
ERROR:  cannot alter type of a column used by a view or rule
DETAIL:  rule _RETURN on view xb_buchversand_positionen depends on column "summe"

Is there a nice way for the stupid me to cascade the alteration?

Kind regards,
Jonatan


-- 
Jonatan Reiners

Am Dienstag, 31. Juli 2012 um 14:13 schrieb Thomas Kellerer:

Sounds like you have different setting for for lc_monetary on the target than on the source.

Make sure both are set to the same value (in postgresql.conf)

That's one of the reasons I don't like the money datatype.
I prefer to store that in a regular numeric column and have the currency in another one

Thomas




--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:

Re: problem with pg_dump

От
Thomas Kellerer
Дата:
Jonatan Reiners, 31.07.2012 14:55:
> Both are set to lc_monetary = 'de_DE.UTF-8'
> Maybe they mean something different on both OSs or one installation is faulty and ignores this setting.

Hmm, that's strange (actually "Eu67.667,00" looks very strange anyway. It should be EUR or € but not Eu)

> I think I will go the way and convert the value to numeric.
>
> unfortunately this doesn't work
> alter table bst alter summe set data type numeric(30,2) using summe::numeric;
> Looks nice but:
> ERROR:  cannot alter type of a column used by a view or rule
> DETAIL:  rule _RETURN on view xb_buchversand_positionen depends on column "summe"
>
> Is there a nice way for the stupid me to cascade the alteration?

Unfortunately not. You need to drop (and re-create) every view that uses that table.

Thomas