[gdal-dev] ogr2ogr with ORACLE driver: limitation on table name size?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] ogr2ogr with ORACLE driver: limitation on table name size?

Victoria Ponz-Sarvise

Hi,

 

I’m using ogr2ogr to upload shapefiles in an Oracle database, and I would like to know if there is a limitation of the number of characters in the created tables names.

In Oracle, until v12.2, the table names where limited to 30 bytes, and after that it is possible to create tables with names 128 bytes long.

The oracle database I’m using is 12.2, but ogr2ogr command truncates my table names to 30 chars.

I can not find in the documentation if there is a limitation in table names sizes in ogr. Can you please tell me if ogr2ogr is able to create table names longer than 30 bytes?

I am using GDAL 2.4.3

 

Thanks for your answer!

Regards

Victoria


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr with ORACLE driver: limitation on table name size?

Ivan Lucena-5
According to that code it should work:


Ticket:


From: gdal-dev <[hidden email]> on behalf of Victoria Ponz-Sarvise <[hidden email]>
Sent: Tuesday, September 15, 2020 9:03 AM
To: [hidden email] <[hidden email]>
Subject: [gdal-dev] ogr2ogr with ORACLE driver: limitation on table name size?
 

Hi,

 

I’m using ogr2ogr to upload shapefiles in an Oracle database, and I would like to know if there is a limitation of the number of characters in the created tables names.

In Oracle, until v12.2, the table names where limited to 30 bytes, and after that it is possible to create tables with names 128 bytes long.

The oracle database I’m using is 12.2, but ogr2ogr command truncates my table names to 30 chars.

I can not find in the documentation if there is a limitation in table names sizes in ogr. Can you please tell me if ogr2ogr is able to create table names longer than 30 bytes?

I am using GDAL 2.4.3

 

Thanks for your answer!

Regards

Victoria


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr with ORACLE driver: limitation on table name size?

Even Rouault-2

Ivan,

 

> https://github.com/OSGeo/gdal/blob/70a2ec1795c3e01aeaf1ac3c0f7c69a3f0fa2ca5/

> gdal/ogr/ogrsf_frmts/oci/ogrocisession.cpp#L316

 

The logic

 

if( nServerVersion >= 12 && nServerRelease >= 2 )

 

looks wrong to me. It will not work for 13.0 for example

 

Shouldn't that be

 

if( nServerVersion > 12 || (nServerVersion == 12 && nServerRelease >= 2) )

 

?

 

That said that doesn't explain issues with 12.2

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr with ORACLE driver: limitation on table name size?

Victoria Ponz-Sarvise

Thanks for your answers.

 

I have reviewed my oracle settings and in fact what I said wasn’t strictly ok… I compiled GDAL using a 12.2 oracle client, but the database I got for the tests is oracle 19… so it won’t work (I think Even is right). Sorry for that bad info in my first mail.

 

I’m going to look for a 12.2 database that I can use for new tests and will keep you informed. Because it should work in that context at least.

 

Victoria

From: Even Rouault <[hidden email]>
Sent: Tuesday, September 15, 2020 4:34 PM
To: [hidden email]
Cc: Ivan Lucena <[hidden email]>; Victoria Ponz-Sarvise <[hidden email]>
Subject: Re: [gdal-dev] ogr2ogr with ORACLE driver: limitation on table name size?

 

Ivan,

 

> https://github.com/OSGeo/gdal/blob/70a2ec1795c3e01aeaf1ac3c0f7c69a3f0fa2ca5/

> gdal/ogr/ogrsf_frmts/oci/ogrocisession.cpp#L316

 

The logic

 

if( nServerVersion >= 12 && nServerRelease >= 2 )

 

looks wrong to me. It will not work for 13.0 for example

 

Shouldn't that be

 

if( nServerVersion > 12 || (nServerVersion == 12 && nServerRelease >= 2) )

 

?

 

That said that doesn't explain issues with 12.2

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr with ORACLE driver: limitation on table name size?

Ivan Lucena-5
In reply to this post by Even Rouault-2
Even,

You are correct.

As you can see in the code above those lines is that it is possible to run in debugging mode to check if the call to OCIServerVersion is been parsed correctly.

Best regards,

Ivan

From: Even Rouault <[hidden email]>
Sent: Tuesday, September 15, 2020 10:33 AM
To: [hidden email] <[hidden email]>
Cc: Ivan Lucena <[hidden email]>; Victoria Ponz-Sarvise <[hidden email]>
Subject: Re: [gdal-dev] ogr2ogr with ORACLE driver: limitation on table name size?
 

Ivan,

 

> https://github.com/OSGeo/gdal/blob/70a2ec1795c3e01aeaf1ac3c0f7c69a3f0fa2ca5/

> gdal/ogr/ogrsf_frmts/oci/ogrocisession.cpp#L316

 

The logic

 

if( nServerVersion >= 12 && nServerRelease >= 2 )

 

looks wrong to me. It will not work for 13.0 for example

 

Shouldn't that be

 

if( nServerVersion > 12 || (nServerVersion == 12 && nServerRelease >= 2) )

 

?

 

That said that doesn't explain issues with 12.2

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr with ORACLE driver: limitation on table name size?

Even Rouault-2
In reply to this post by Even Rouault-2

On mardi 15 septembre 2020 16:33:51 CEST Even Rouault wrote:

> Ivan,

>

> > https://github.com/OSGeo/gdal/blob/70a2ec1795c3e01aeaf1ac3c0f7c69a3f0fa2ca

> > 5/ gdal/ogr/ogrsf_frmts/oci/ogrocisession.cpp#L316

>

> The logic

>

> if( nServerVersion >= 12 && nServerRelease >= 2 )

>

> looks wrong to me. It will not work for 13.0 for example

>

> Shouldn't that be

>

> if( nServerVersion > 12 || (nServerVersion == 12 && nServerRelease >= 2) )

 

I've committed the above change

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr with ORACLE driver: limitation on table name size?

Victoria Ponz-Sarvise

Hi,

I’m not familiar with your workflow. When will this correction be available to use?

Thanks

Victoria

 

 

On mardi 15 septembre 2020 16:33:51 CEST Even Rouault wrote:

> Ivan,

>

> > https://github.com/OSGeo/gdal/blob/70a2ec1795c3e01aeaf1ac3c0f7c69a3f0fa2ca

> > 5/ gdal/ogr/ogrsf_frmts/oci/ogrocisession.cpp#L316

>

> The logic

>

> if( nServerVersion >= 12 && nServerRelease >= 2 )

>

> looks wrong to me. It will not work for 13.0 for example

>

> Shouldn't that be

>

> if( nServerVersion > 12 || (nServerVersion == 12 && nServerRelease >= 2) )

 

I've committed the above change

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr with ORACLE driver: limitation on table name size?

Even Rouault-2

On mercredi 16 septembre 2020 08:02:11 CEST Victoria Ponz-Sarvise wrote:

> Hi,

> I'm not familiar with your workflow. When will this correction be available

> to use? Thanks

 

in 3.1.4 or 3.2.0, whichever is first released.

 

But as you compiled GDAL from source, you could just patch your copy with

https://github.com/OSGeo/gdal/commit/71f41dc7b4840807cdf3c05ef435a4533c806898

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev