Opened 4 years ago

Closed 16 months ago

#6394 closed defect (wontfix)

ODBC driver only allows 500 columns to be brought over

Reported by: robe Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
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 4 years ago.
increase odbc max column from 500 to 1024

Download all attachments as: .zip

Change History (9)

Changed 4 years ago by robe

Attachment: cpl_odbc.cpp.patch added

increase odbc max column from 500 to 1024

comment:1 Changed 4 years 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 4 years 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 4 years ago by Even Rouault

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

comment:4 Changed 4 years 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 4 years 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 4 years ago by Even Rouault

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

comment:7 Changed 4 years ago by Even Rouault

Milestone: 2.0.3

comment:8 Changed 16 months ago by Even Rouault

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub?. If you believe this ticket is still valid, you may file it to if it is not already reported there.

Note: See TracTickets for help on using tickets.