pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Szűcs Gábor <surrano@gmail.com>
To: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: can't set client_encoding in 7.3.2.9 - crlf bug?
Date: Tue, 22 Mar 2005 11:13:36 +0100
Message-ID: <423FEFD0.5010509@gmail.com> (raw)

Dear Gurus,

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

I try to use the 7.3.2.9 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
    noticed.

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:

    hdbc->Attributes->Add(
	"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.

QUESTIONS:
a) is it a known problem with drivers up to, and including, 7.3.2.4?
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?

TIA,
--
G.

-- Below is the head of postgresql.log
conn=36125152, PGAPI_DriverConnect(in)='DRIVER={PostgreSQL};UID=sd;
PWD=xxxxx;SERVER=tir;PORT=5432;DATABASE=tir;BI=4;UniqueIndex=1;ReadOnly=0;
Protocol=6.4;FakeOidIndex=0;ShowOidColumn=0;RowVersioning=0;ShowSystemTables=0;
ConnSettings=set client_encoding to 'SQL_ASCII';Fetch=100;Socket=4096;
UnknownSizes=0;MaxVarcharSize=254;MaxLongVarcharSize=8190;Debug=0;CommLog=1;
Optimizer=1;Ksqo=1;UseDeclareFetch=0;TextAsLongVarchar=1;UnknownsAsLongVarchar=0;
BoolsAsChar=0;Parse=0;CancelAsFreeStmt=0;ExtraSysTablePrefixes=dd_;
LFConversion=1;UpdatableCursors=1;DisallowPremature=0;TrueIsMinus1=0;', 
fDriverCompletion=0
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_encoding='SQL_ASCII'
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''
conn=36125152, 
PGAPI_DriverConnect(out)='DRIVER={PostgreSQL};DATABASE=tir;SERVER=tir;PORT=5432;
UID=sd;PWD=xxxxx;A6=set+client%5fencoding+to+%27SQL%5fASCII%27;A7=100;A8=4096;
B0=254;B1=8190;BI=4;C2=dd_;CX=1b107ab'
--



Message-ID: <423FEFD0.5010509@gmail.com>
Permalink:  ../423FEFD0.5010509@gmail.com/
Also on:    postgresql.org/message-id/423FEFD0.5010509@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: surrano@gmail.com
  Subject: Re: can't set client_encoding in 7.3.2.9 - crlf bug?
  In-Reply-To: <423FEFD0.5010509@gmail.com>
  References: <423FEFD0.5010509@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox