Thread: Fwd: Bug#380047: libpq-dev: no declaration for pg_encoding_to_char

Fwd: Bug#380047: libpq-dev: no declaration for pg_encoding_to_char

From
Martin Pitt
Date:
Hi PostgreSQL developers,

I recently got this bug report about a missing declaration of
pg_encoding_to_char() in the official client library headers
(PostgreSQL 8.1.4). This causes some build problems of depending
packages like the ruby bindings [1].

So, should this function be declared in libpq-fe.h (or pg_wchar.h
included into the postgresql client development package), or is this
function obsolete?

Thank you!

Martin

[1] http://bugs.debian.org/18858

----- Forwarded message from Matej Vela <vela@debian.org> -----

Subject: Bug#380047: libpq-dev: no declaration for pg_encoding_to_char
Reply-To: Matej Vela <vela@debian.org>, 380047@bugs.debian.org
From: Matej Vela <vela@debian.org>
To: submit@bugs.debian.org
Date: Thu, 27 Jul 2006 06:45:37 +0200
X-Spam-Status: No, score=3D2.7 required=3D4.0 tests=3DAWL,BAYES_50,
    DATE_IN_FUTURE_06_12 autolearn=3Dno version=3D3.0.3

Package: libpq-dev
Version: 8.1.4-5

Chapter 21.2.3 ("Automatic Character Set Conversion Between Server and
Client") documents several functions:

  int PQsetClientEncoding(PGconn *conn, const char *encoding);
    where conn is a connection to the server, and encoding is the
    encoding you want to use. If the function successfully sets the
    encoding, it returns 0, otherwise -1. The current encoding for this
    connection can be determined by using:
  int PQclientEncoding(const PGconn *conn);
    Note that it returns the encoding ID, not a symbolic string such as
    EUC_JP. To convert an encoding ID to an encoding name, you can use:
  char *pg_encoding_to_char(int encoding_id);

The first two are declared in <libpq-fe.h>, but pg_encoding_to_char()
seems to be in <mb/pg_wchar.h>, which is not included in the package.
If this interface is private or deprecated, consider this a
documentation bug.

Thanks,

Matej

----- End forwarded message -----

--=20
Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org

In a world without walls and fences, who needs Windows and Gates?

Re: Fwd: Bug#380047: libpq-dev: no declaration for pg_encoding_to_char

From
Alvaro Herrera
Date:
Martin Pitt wrote:

Hi,

> I recently got this bug report about a missing declaration of
> pg_encoding_to_char() in the official client library headers
> (PostgreSQL 8.1.4). This causes some build problems of depending
> packages like the ruby bindings [1].
>
> So, should this function be declared in libpq-fe.h (or pg_wchar.h
> included into the postgresql client development package), or is this
> function obsolete?

This function has been defined in pg_wchar.h for a long time, and is
certainly not deprecated.  OTOH I don't think it makes much sense to put
that function declaration in libpq-fe.h, because it's not exclusive of
frontends.

The correct solution seems to be that the libpq-dev package must include
mb/pg_wchar.h.  Not sure how reasonable that is for your package set; if
there's a package with the rest of the headers, probably it'll have to
depend on libpq-dev or something.


> [1] http://bugs.debian.org/18858

I find this one more closely related to the topic at hand:

http://bugs.debian.org/318858

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

Re: Fwd: Bug#380047: libpq-dev: no declaration for pg_encoding_to_char

From
Martin Pitt
Date:
Hi Alvaro,

Alvaro Herrera [2006-07-29 21:41 -0400]:
> The correct solution seems to be that the libpq-dev package must include
> mb/pg_wchar.h.=20=20

Many thanks for your explanations. This is trivial to do.

> > [1] http://bugs.debian.org/18858
>=20
> I find this one more closely related to the topic at hand:
>=20
> http://bugs.debian.org/318858

Erm, yes, yay for my typos. :/=20
/me looks on the floor for a dropped '3'.

Have a nice Sunday,

Martin

--=20
Martin Pitt              http://www.piware.de
Ubuntu Developer   http://www.ubuntulinux.org
Debian Developer        http://www.debian.org