Re: Segfault When Fetching NVARCHAR(MAX) Column
Frediano Ziglio <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CAHt6W4cn9iRxEfHTz4YkkhEASdYwCakyEBAO6Ofz1F-LRN_syw@mail.gmail.com> |
Hi Marc,
I found the fix to SQLWCHAR/Py_UNICODE mismatch (just updated pyodbc
to 2.18) but there is still the segmentation fault. This programs
works as expected
import pyodbc
conn = pyodbc.connect('DSN=sqlexpress;UID=sa;PWD=XXXX')
cursor = conn.cursor()
cursor.execute("SELECT CAST(REPLICATE('a',511) AS NVARCHAR(MAX))")
cursor.fetchall()
(obviously changing connection string), but just changing 511 to 512
lead to segmentation fault.
Please open a case to pyodbc and let us know. I tested quite deeply
and it seems problem is in pyodbc (FreeTDS and unixODBC returns
correctly writing data correctly to pointers passed by pyodbc).
Frediano
2011/7/12 Marc DellaVolpe <[email protected]>:
> I have run into a strange issue with SQLAlchemy/PyODBC/FreeTDS/unixODBC/
> SQL Server 2005 that I was hoping someone can shed some light on.
>
> I have two SQL Server 2005 instances with the same table created on
> each. The contents of the tables differ. The servers appear to be
> identical to each other in configuration except that the builds of SQL
> Server are different. When fetching rows on from the newer build,
> the fetch succeeds as normal. When fetching rows from the older
> build, pyodbc.so segfaults. The same query/fetch works fine in tsql/
> isql from the command line which leads me to believe that it is not a
> FreeTDS issue. I am not sure where the issue lies but I figured I
> would try with PyODBC and FreeTDS. Is it possible that there is some
> bad data in the table to cause this? I have attached a dump from each
> session. You will notice a truncation error message at the end of the
> segfaulting log, The longest row in that table is length 509 / data
> length 1018 so I am not sure about the context of this error message.
>
> As a temporary work around, I have changed the column to varchar(max)
> which works. As a last resort, I can apply the updates to the
> segfaulting database but I would greatly appreciate more insight into
> this issue before I do.
>
> The working instance:
>
> Microsoft SQL Server 2005 - 9.00.1406.00 (Intel X86)
> Mar 3 2007 18:40:02
> Copyright (c) 1988-2005 Microsoft Corporation
> Developer Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
>
> Dump of session - http://pastebin.com/8NcDkvQy
>
> The segfaulting instance:
>
> Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
> Oct 14 2005 00:33:37
> Copyright (c) 1988-2005 Microsoft Corporation
> Workgroup Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
>
> Dump of session - http://pastebin.com/vAtPVZvD
>
> Thank You,
> - Marc
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds