Обсуждение: pg_dumpall: pg_conversion table not saved

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

pg_dumpall: pg_conversion table not saved

От
Michael Enke
Дата:
Hi list,
I updated pg_converion to set the condefault=false where I need it.
pg_dumpall does NOT write that table out and therefore it is not possible to restore, this update get lost.
Anybody know if this is an error or has an explanation why it has to work this way?

Background:
I have created my own conversion with CREATE DEFAULT CONVERSION ...
http://www.postgresql.org/docs/8.3/interactive/sql-createconversion.html
 > There should be only one default encoding in a schema for the encoding pair

Why can not the "CREATE DEFAULT CONVERSION ..."
      a) return with an error if there is another default conversion existing or
      b) silently set any other default to false
for the confor- and conto-encoding involved?

Regards,
Michael

--
Wincor Nixdorf International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Gesch�ftsf�hrer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Dr. J�rgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193

Diese E-Mail enth�lt vertrauliche Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrt�mlich
erhaltenhaben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie
dieunbefugte Weitergabe dieser E-Mail ist nicht gestattet. 

This e-mail may contain confidential information. If you are not the intended recipient (or have received this e-mail
inerror) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or
distributionof the material in this e-mail is strictly forbidden. 


Re: pg_dumpall: pg_conversion table not saved

От
Tom Lane
Дата:
Michael Enke <michael.enke@wincor-nixdorf.com> writes:
> I updated pg_converion to set the condefault=false where I need it.

Why are you needing to replace an existing default conversion?
Do we have a bug in it?

> pg_dumpall does NOT write that table out and therefore it is not possible to restore, this update get lost.

pg_dump does not (and shouldn't) dump system-defined objects.  It has
no way to know that you modified the definition of such an object.

> Why can not the "CREATE DEFAULT CONVERSION ..."
>       a) return with an error if there is another default conversion existing or

AFAICS it does.

            regards, tom lane

Re: pg_dumpall: pg_conversion table not saved

От
Martijn van Oosterhout
Дата:
On Wed, May 07, 2008 at 05:38:12PM -0400, Tom Lane wrote:
> Michael Enke <michael.enke@wincor-nixdorf.com> writes:
> > I updated pg_converion to set the condefault=false where I need it.
>
> Why are you needing to replace an existing default conversion?
> Do we have a bug in it?

He doesn't really. See his message two days ago about wanting to add
another charset. Since postgresql doesn't support that he hijacked an
existing one and replaced the conversion functions. And they're not
saved/restored.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

Вложения

Re: pg_dumpall: pg_conversion table not saved

От
Michael Enke
Дата:
Tom Lane schrieb:
> Michael Enke <michael.enke@wincor-nixdorf.com> writes:
>> I updated pg_converion to set the condefault=false where I need it.
>
> Why are you needing to replace an existing default conversion?
> Do we have a bug in it?

No, not a bug. But I need CP852 encoding conversion. Maybe you can take a look at
http://archives.postgresql.org/pgsql-general/2008-05/msg00185.php
and give your comment.

Is the CREATE CONVERSION only for the case that there is a bug in existing default conversions? ;-)

>> pg_dumpall does NOT write that table out and therefore it is not possible to restore, this update get lost.
>
> pg_dump does not (and shouldn't) dump system-defined objects.  It has
> no way to know that you modified the definition of such an object.
>
>> Why can not the "CREATE DEFAULT CONVERSION ..."
>>       a) return with an error if there is another default conversion existing or
>
> AFAICS it does.

You can try with attached library:

   CREATE FUNCTION utf82cp852(integer,integer,cstring,internal,integer)
   RETURNS void AS '/tmp/libencodings' LANGUAGE 'C';
   CREATE FUNCTION cp8522utf8(integer,integer,cstring,internal,integer)
   RETURNS void AS '/tmp/libencodings' LANGUAGE 'C';

   CREATE DEFAULT CONVERSION utf82cp852 FOR 'UNICODE' TO 'LATIN2' FROM utf82cp852;
   CREATE DEFAULT CONVERSION cp8522utf8 FOR 'LATIN2' TO 'UNICODE' FROM cp8522utf8;

It doesn't complain but it also is not the encoding used now
since utf8_to_iso_8859_2 / iso_8859_2_utf8 has still condefault=true.
If I now set condefault to false, my conversion function is used.

Regards,
Michael

--
Wincor Nixdorf International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Dr. Jürgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193

Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich
erhaltenhaben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie
dieunbefugte Weitergabe dieser E-Mail ist nicht gestattet. 

This e-mail may contain confidential information. If you are not the intended recipient (or have received this e-mail
inerror) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or
distributionof the material in this e-mail is strictly forbidden. 


Вложения