Opened 19 months ago

Last modified 14 months ago

#6394 new defect

ODBC driver only allows 500 columns to be brought over

Reported by: robe Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: 2.0.2
Severity: normal Keywords: odbc


I had someone come to me using Postgres ogr_fdw driver trying to foreign table against SQL Serve table that had 1024 columns (which is the limit for Postgres) and only 500 columns came over.

At Even's suggestion I patched up the latest GDAL 2.0 branch and built him a build to test with. He said that fixed his problems.

Not sure if there is any downside to increasing that number to higher than its current 500 so perhaps this can't go in 2.0 and needs to be slated for 2.1, or just a bad idea in general.

Attachments (1)

cpl_odbc.cpp.patch (600 bytes) - added by robe 19 months ago.
increase odbc max column from 500 to 1024

Download all attachments as: .zip

Change History (8)

Changed 19 months ago by robe

Attachment: cpl_odbc.cpp.patch added

increase odbc max column from 500 to 1024

comment:1 Changed 19 months ago by robe

Correction sounds like Postgres can go as high as 1600 columns. Anyway I'd be happy with 1024.

Only downside I can think of is that a data source that can handle less than max set, conversion to that would fail. Then again failing might be better than succeeding and silently leaving out half your data.

comment:2 Changed 19 months ago by Even Rouault

Actually looking at the code of CPLODBCStatement::GetColumns?(), it looks like it could be improved to handle a unlimited number of columns. It would be a matter of resizing with CPLRealloc() the various m_XXXX arrays in the for( iCol = 0; iCol < m_nColCount; iCol++ ) loop, each time iCol reachings the current max size.

comment:3 Changed 19 months ago by Even Rouault

Shoud I apply your patch as it, or are you considering the improvement I suggested ?

comment:4 Changed 19 months ago by robe

I think for 2.0 best to apply what I have, less invasive. For 2.1 I like your idea and will try to do that as I study thru the ODBC for the other issue.

comment:5 Changed 19 months ago by Even Rouault

OK, only applied in 2.0 branch for now :

branches/2.0 r33624 "CPLODBCStatement::GetColumns?(): support up to 1024 columns (patch by Regina Obe, #6394)"

comment:6 Changed 15 months ago by Even Rouault

Removing target milestone as it corresponds to a now closed milestone.

comment:7 Changed 14 months ago by Even Rouault

Milestone: 2.0.3
Note: See TracTickets for help on using tickets.