Skip site navigation (1) Skip section navigation (2)

Re: libpq5 8.3 breaks 8.2 compatibility with encodings

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Martin Pitt" <martin(at)piware(dot)de>,"PostgreSQL Bugs" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: libpq5 8.3 breaks 8.2 compatibility with encodings
Date: 2007-10-12 17:00:36
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
Tom Lane wrote:
> Martin Pitt <martin(at)piware(dot)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

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

In response to


pgsql-bugs by date

Next:From: Tom LaneDate: 2007-10-12 17:06:42
Subject: Re: BUG #3674: Unnecessary checkpoints by WAL Writer
Previous:From: Tom LaneDate: 2007-10-12 16:54:27
Subject: Re: libpq5 8.3 breaks 8.2 compatibility with encodings

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group