Re: [gdal-dev] Export PG to GPKG with foreign keys
Hi Even, thanks for the reply! I had this feeling, but now I'm sure Cheers and thanks Matteo On 4/19/24 11:32, Even Rouault wrote: Le 19/04/2024 à 10:25, Matteo Ghetta via gdal-dev a écrit : Hi all, I'm trying to export a PG table with several foreign keys to a geopackage. What I tried so far are the native QGIS export and the QGIS Processing algorithm "Package layer" with the "Export related layers following..." option activated. I'm checking ogr2ogr but I cannot see any option to include the export of the foreign keys. Is this option available in order to have a geopackage with the original table with all the other related tables? In short, no It might be possible to use the relationship API of https://gdal.org/api/gdaldataset_cpp.html#_CPPv4NK11GDALDataset20GetRelationshipNamesE12CSLConstList to build something around it. But adding foreign key constraint themselves would be tricky as it requires to rewrite the CREATE TABLE. Even ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Export PG to GPKG with foreign keys
Le 19/04/2024 à 10:25, Matteo Ghetta via gdal-dev a écrit : Hi all, I'm trying to export a PG table with several foreign keys to a geopackage. What I tried so far are the native QGIS export and the QGIS Processing algorithm "Package layer" with the "Export related layers following..." option activated. I'm checking ogr2ogr but I cannot see any option to include the export of the foreign keys. Is this option available in order to have a geopackage with the original table with all the other related tables? In short, no It might be possible to use the relationship API of https://gdal.org/api/gdaldataset_cpp.html#_CPPv4NK11GDALDataset20GetRelationshipNamesE12CSLConstList to build something around it. But adding foreign key constraint themselves would be tricky as it requires to rewrite the CREATE TABLE. Even -- http://www.spatialys.com My software is free, but my time generally not. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev