PostgreSQL, ODBC and long strings

From: charlie clark <charlie(at)begeistert(dot)org>
To: pgsql-odbc(at)postgresql(dot)org
Subject: PostgreSQL, ODBC and long strings
Date: 2005-05-11 19:22:42
Message-ID: opsqmlf4yoyt02yl@mail.isis.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Further to my earlier post I have done some investigating. It turns out
the problems is with all strings greater than 255 characters which are
automatically converted to LO.

The statement of the form

cursor.execute("SELECT value FROM table WHERE x = ?", (a_value, ))

where a_value is a string longer than 255 characters always generates an
error of the form
ProgrammingError: ('HY000', 7, 'ERROR: type "lo" does not exist', 5898)

The ODBC.log

STATEMENT ERROR: func=SC_execute, desc='', errnum=7, errmsg='Error while
executing the query'
------------------------------------------------------------
hdbc=28785640, stmt=28779072, result=28813312
manual_result=0, prepare=1, internal=0
bindings=0, bindings_allocated=0
parameters=28817032, parameters_allocated=1
statement_type=0, statement='SELECT id FROM
localekit_attributes where attribute = ?'
stmt_with_params='SELECT id FROM localekit_attributes
where attribute = '829028'::lo'
data_at_exec=-1, current_exec_param=-1, put_data=0
currTuple=-1, current_col=-1, lobj_fd=-1
maxRows=0, rowset_size=1, keyset_size=0, cursor_type=0,
scroll_concurrency=1
cursor_name='SQL_CUR01B72240'
----------------QResult Info
-------------------------------
fields=28815040, manual_tuples=0, backend_tuples=0,
tupleField=0, conn=0
fetch_count=0, num_total_rows=0, num_fields=0,
cursor='(NULL)'
message='ERROR: operator does not exist: text = lo',
command='(NULL)', notice='(NULL)'
status=7, inTuples=0
CONN ERROR: func=SC_execute, desc='', errnum=110, errmsg='ERROR: type
"lo" does not exist'
------------------------------------------------------------
henv=28785584, conn=28785640, status=1, num_stmts=16
sock=28778336, stmts=28815080, lobj_type=-999
---------------- Socket Info -------------------------------
socket=600, reverse=0, errornumber=0, errormsg='(NULL)'
buffer_in=34283600, buffer_out=34291800
buffer_filled_in=11, buffer_filled_out=0, buffer_read_in=11

It seems that the ODBC driver is not returning enough information about
the datatype text and that the Python ODBC driver is automatically
converting to a large object for strings more than 255 characters in
length.

What possible solutions are there to this problem? defining the lo type?
or improving the information provided by the ODBC driver?

Thanks for any pointers

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D-40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226

Browse pgsql-odbc by date

  From Date Subject
Next Message Fernando Gonzlez V. 2005-05-12 14:53:18 Help postgresql 8.0.3 and psqlodbc
Previous Message Joel Fradkin 2005-05-11 18:54:13 Re: encoding