Re: libpq5 8.3 breaks 8.2 compatibility with encodings

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: libpq5 8.3 breaks 8.2 compatibility with encodings
Дата
Msg-id 470FA834.2010908@enterprisedb.com
обсуждение исходный текст
Ответ на Re: libpq5 8.3 breaks 8.2 compatibility with encodings  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: libpq5 8.3 breaks 8.2 compatibility with encodings
Re: libpq5 8.3 breaks 8.2 compatibility with encodings
Список pgsql-bugs
Tom Lane wrote:
> Martin Pitt <martin@piware.de> writes:
>> However, if I use 8.2 programs with the 8.3 library, things start to
>> become weird:
>
>>   $ # kill postgres instance
>>   $ rm -rf /tmp/x; LC_ALL=3Den_US.UTF-8 /usr/lib/postgresql/8.2/bin/initdb =
>> --encoding UTF8 -D /tmp/x
>
> Does anything other than initdb get weird?
>
> For the most part I believe it's the case that libpq's idea of the enum
> values is independent of the backend's.  I think the issue here is that
> initdb is (mis) using libpq's pg_char_to_encoding, etc, and combining
> those functions with its own idea of the meanings of the enum values.
>
> Maybe we should stop exporting pg_char_to_encoding and so on from libpq,
> though I wonder if that would break any clients.

I'm in favor not exporting them in the long term, a normal client
program should have no business calling those functions.

Note that we've also added PG_EUC_JIS_2004 and PG_SJIS (client-only) to
the enumeration. That means that all the previous client-only encodings
have been shifted by two.

If we want to keep the functions compatible when possible, we could:
* replace JOHAB in the enum with a deprecated placeholder, and
* move PG_JOHAB to the end of the enum, instead of the shoving it in the
middle of client-only encodings, and
* move PG_SJIS to the end, to shift the rest of the client-only
encodings by one, to compensate the addition of the new PG_EUC_JIS_2004
encoding.

PG_JOHAB and PG_SJIS would have different encoding identifiers than in
8.2, but the rest would stay put.

But OTOH, I feel we should just stop exporting them now; I don't think
there's a legitimate use case for a client application to use them. The
best I can think of is an application that would want to know what
encodings there is, and show them in a menu or something. But even then,
you shouldn't use the numeric values, just the encoding names.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: libpq5 8.3 breaks 8.2 compatibility with encodings
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #3674: Unnecessary checkpoints by WAL Writer