Thread: NOTICE: Unrecognized variable client_encoding

NOTICE: Unrecognized variable client_encoding

From
Bishop
Date:
Good afternoon,

I'm writing an application to store and retrieve meteo data. I want it
to be reliable. Since compiling PostgreSQL 6.5.2 I have seen "NOTICE:
unrecognized variable client_encoding" messages, although data do not
appear to be getting lost or corrupted. Is this message important, or
can I safely ignore it?

I've searched through this mailing list archive for messages containing
the keyword "notice"
before making this post, but it doesn't seem bother anyone else.

I want this application to be reliable as I'm introducing Linux to our
lab (an ODBC driver will be the next phase for my colleagues losing
productivity with Windows...).

Here's some background info:

Data from a meteo station are copied to a PostgreSQL data base. Data are
transferred over an IEEE-488 bus by a Perl script run hourly from cron
(exploiting the Linux-GPIB software from Berlin University). Initial
development was done on a RedHat 5.2 Linux system (data acquisition and
PostgreSQL 6.4.2 database on the same host, running a 2.0.34 kernel).

The Perl script used the Pg module (obtained with the 6.4.2
distribution) rather than Perl DBI / DBD to perform a fast copy
operation into the table.

As data accumulated, select operations became too slow (the original
host is only a 66MHz 486 system). Now I've compiled PostgreSQL 6.5.2 on
a different host (400MHz Pentium with UltraSCSI disks) running RedHat
6.0 (Linux 2.2.15 kernel). Incidentally, the compile proceeded without
problems, and both regression tests (normal and big) executed without
serious errors.

I reproduced the database tables on this new system without problems.
But when I run the Perl script from my old host (edited appropriately to
specify the new host name), I get the above warning, although data
appears to be copied correctly over the network connection.

I noted that psql to the new host works without a hitch from different
hosts running RedHat Linux 5.2 (2.0.34 kernel).

PostgreSQL is running on the RedHat Linux 6.0 host (named "grebe"),
started by the following command line:

su -l postgres -c '/usr/local/pgsql/bin/postmaster -i -S -D/meteo
>>/meteo/pglog 2>&1'

Here is a Perl script (adapted from the Pg test suite) to connect to a
PostgreSQL database (named "noct") running on a remote host:

#!/usr/bin/perl -w

use Pg;
use strict;

my ($conn);

my $Option_ref = Pg::conndefaults();
my ($key, $val);
( $$Option_ref{port} ne "" && $$Option_ref{dbname} ne "" &&
$$Option_ref{user} ne "" )   and print "Pg::conndefaults ........ ok\n"   or  die   "Pg::conndefaults ........ not ok:
",$conn->errorMessage;
 
$conn = Pg::connectdb("host=grebe dbname=noct");
( PGRES_CONNECTION_OK eq $conn->status )   and print "Pg::connectdb ........... ok\n"   or  die   "Pg::connectdb
...........not ok: ", $conn->errorMessage;
 


When this script is run from Linux 2.0.34 to connect to PostgreSQL 6.5.2
running on Linux 2.2.15, it gives the following output:

Pg::conndefaults ........ ok
NOTICE:  Unrecognized variable client_encoding
Pg::connectdb ........... ok

If I run the same script between two Linux 2.0.34 systems to connect to
a remote PostgreSQL 6.4.2 server I get the following output:

Pg::conndefaults ........ ok
Pg::connectdb ........... ok

Is this NOTICE message important, or can I safely ignore it?

James Bishop


Re: [INTERFACES] NOTICE: Unrecognized variable client_encoding

From
Tom Lane
Date:
Bishop <james.bishop@jrc.it> writes:
> to be reliable. Since compiling PostgreSQL 6.5.2 I have seen "NOTICE:
> unrecognized variable client_encoding" messages, although data do not
> appear to be getting lost or corrupted. Is this message important, or
> can I safely ignore it?

Evidently you compiled the server without the MULTIBYTE option, but
are invoking it with a client whose libpq was compiled with the option.
libpq is trying to tell the server what multibyte character set it
wants to use, and the server is responding that it hasn't got that
feature.

If you aren't worried about non-US-ASCII characters then leaving
MULTIBYTE off is good; otherwise you may want to rebuild with it on.
In any case, to get rid of the notice you'd need to build the client
library with the same options as the server.
        regards, tom lane


Re: [INTERFACES] NOTICE: Unrecognized variable client_encoding

From
Bishop
Date:
Dear Tom,

Thankyou for your advice. I checked the config.status file kept from the
PostgreSQL 6.4.2 build and found that I had indeed specified the
--with-mb=LATIN1 configuration option.

I've recompiled 6.5.2 with this option, and the notice message has
disappeared.

Many thanks,
James Bishop