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

can't set client_encoding in - crlf bug?

From: Szűcs Gábor <surrano(at)gmail(dot)com>
To: "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Subject: can't set client_encoding in - crlf bug?
Date: 2005-03-22 10:13:36
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc
Dear Gurus,

Driver: snapshot
Server: Linux 7.4.6
OS: Win2k SP4
Other: Borland C++Builder 5, ODBCExpress 6.0

I try to use the snapshot in hope of a bugfix (may or may not be a 
psqlodbc issue, described below)

I use a "DSNless connection", and set ConnSettings according to what found 
on the net. Indeed it seems to do something, but too early.

Below is the start of the psqlodbc.log.
Notice two things:

a) connect in and connect out differs in connsettings (latter uses something
    that reminds me of url notation (%5f etc). This may be normal, just

b) conn_settings kicks in and sets cl_e to ascii, but _LATER_ someone still
    sets it to utf8.

I tried setting HKLM\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL\ConnSettings 
despite that I set it in C++ like this:

	"ConnSettings=set client_encoding to 'SQL_ASCII';");

for no success.

The bug that caused me to try newer versions (assuming that it's related to 
the driver) is something between OE and the driver, and related to 
MaxVarCharSize. Using the default, 254, tried reading a varchar field, 
containing a string of 51x3 characters + 51 line breaks. This adds up to 
51x4 = 204 characters in Linux (LF), thus fits in VarChar. However, it's 
51x5 = 255 characters in Windows (CRLF). It seems to me that OE reserves 
sufficient buffer to receive a varchar (254 bytes), but gets 255 bytes instead.

a) is it a known problem with drivers up to, and including,
b) is it a problem of the driver, or a problem of OE?
c) if it's a problem of the driver, is there a fix in the upcoming drivers?
d) We are not ready to upgrade to 8.x yet; provided that there is a fix, how
    do I make a newer driver work with my client encoding?


-- Below is the head of postgresql.log
conn=36125152, PGAPI_DriverConnect(in)='DRIVER={PostgreSQL};UID=sd;
ConnSettings=set client_encoding to 'SQL_ASCII';Fetch=100;Socket=4096;
Global Options: Version='07.03.0209', fetch=100, socket=4096, 
unknown_sizes=0, max_varchar_size=254, max_longvarchar_size=8190
                 disable_optimizer=1, ksqo=1, unique_index=1, use_declarefetch=0
                 text_as_longvarchar=1, unknowns_as_longvarchar=0, 
bools_as_char=0 NAMEDATALEN=64
                 extra_systable_prefixes='dd_', conn_settings='' 
conn=36125152, query=' '
conn=36125152, query='select version()'
     [ fetched 1 rows ]
     [ PostgreSQL version string = 'PostgreSQL 7.4.6 on i686-pc-linux-gnu, 
compiled by GCC 2.95.4' ]
     [ PostgreSQL version number = '7.4' ]
conn=36125152, query='set DateStyle to 'ISO''
conn=36125152, query='set geqo to 'OFF''
conn=36125152, query='set extra_float_digits to 2'
conn=36125152, query='set client_encoding to 'SQL_ASCII''
conn=36125152, query='select oid from pg_type where typname='lo''
     [ fetched 0 rows ]
conn=36125152, query='select pg_client_encoding()'
     [ fetched 1 rows ]
     [ Client encoding = 'SQL_ASCII' (code = 0) ]
conn=36125152, query='set client_encoding to 'UTF8''

pgsql-odbc by date

Next:From: BETTON NicolasDate: 2005-03-22 11:31:09
Subject: Installing PsqlODBC with libiodbc3-52.2 on Linux Fedora Core 1
Previous:From: Tom LaneDate: 2005-03-21 19:46:29
Subject: Re: 32-bit ints on 64-bit linux

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