Tom Lane wrote:
> Martin Pitt <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate

Reply via email to