qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.34k stars 2.98k forks source link

error with GDAL Export to PostgreSQL #54610

Closed gubuntu closed 12 months ago

gubuntu commented 12 months ago

What is the bug or the crash?

In trying @disarticulate's workaround to #32255, the process runs with no errors but actually does nothing. Maybe because the GDAL command has an error in the schema flag where public is written public" instead of 'public'?

QGIS version: 3.32.0-Lima
QGIS code revision: b9862de816
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.3.2
GEOS version: 3.9.1-CAPI-1.14.2
PROJ version: Rel. 8.1.1, September 1st, 2021
PDAL version: 2.3.0 (git-version: Release)
Algorithm started at: 2023-09-15T12:57:01
Algorithm 'Export to PostgreSQL (available connections)' starting…
Input parameters:
{ 'ADDFIELDS' : False, 'APPEND' : False, 'A_SRS' : None, 'CLIP' : False, 'DATABASE' : 'sandbox on local', 'DIM' : 0, 'GEOCOLUMN' : 'geom', 'GT' : '', 'GTYPE' : 3, 'INDEX' : False, 'INPUT' : 'memory://Point?crs=ESRI:102564&field=id:integer(-1,0)&field=fid:string(-1,0)&field=Killdate:string(-1,0)&field=Latitude:string(-1,0)&field=Longitude:string(-1,0)&field=Kill:string(-1,0)&field=Spp%20Killed:string(-1,0)&field=Sex:string(-1,0)&field=Comment:string(-1,0)&field=Lion:string(-1,0)&field=Age:string(-1,0)&uid={993a46a9-7686-4b35-80ff-f3ff022171d7}', 'LAUNDER' : False, 'OPTIONS' : '', 'OVERWRITE' : True, 'PK' : 'id', 'PRECISION' : True, 'PRIMARY_KEY' : '', 'PROMOTETOMULTI' : False, 'SCHEMA' : 'public', 'SEGMENTIZE' : '', 'SHAPE_ENCODING' : '', 'SIMPLIFY' : '', 'SKIPFAILURES' : False, 'SPAT' : None, 'S_SRS' : None, 'TABLE' : None, 'T_SRS' : None, 'WHERE' : '' }

GDAL command:
ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL "PG:dbname='sandbox' host=localhost port=5432 user='xxx' password='xxx' sslmode=disable active_schema=public" -lco DIM=2 /private/var/folders/8b/12slfx955yj25xt6x1_zjz8m0000gq/T/processing_Mzlivd/fba4ca65a4504fa19b6992a766d3b13b/INPUT.gpkg INPUT -overwrite -nlt POINT -lco GEOMETRY_NAME=geom -lco FID=id -nln public.input
GDAL command output:
0...10...20...30...40...50...60...70...80...90...100 - done.
Process completed successfully
Execution completed in 1.08 seconds
Results:
{}

Loading resulting layers
Algorithm 'Export to PostgreSQL (available connections)' finished

Steps to reproduce the issue

attempt to load a layer into PostgreSQL with the GDAL Export to PostgreSQL tool

Versions

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

QGIS version | 3.32.0-Lima | QGIS code revision | b9862de816 -- | -- | -- | -- Qt version | 5.15.2 Python version | 3.9.5 GDAL/OGR version | 3.3.2 PROJ version | 8.1.1 EPSG Registry database version | v10.028 (2021-07-07) GEOS version | 3.9.1-CAPI-1.14.2 SQLite version | 3.35.2 PDAL version | 2.3.0 PostgreSQL client version | unknown SpatiaLite version | 5.0.1 QWT version | 6.1.6 QScintilla2 version | 2.11.5 OS version | macOS 12.6   |   |   |   Active Python plugins ORStools | 1.6.0 SemiAutomaticClassificationPlugin | 7.10.11 dataset_qa_workbench | 0.7.1 pg_metadata | 1.2.2 changeDataSource | 3.1 quick_map_services | 0.19.33 stream_feature_extractor | 2.0.0 splitmultipart | 1.0.0 cartography_tools | 1.2.1 nominatim | 1.4.5 linking_relation_editor | v1.2.0 QgisModelBaker | v7.5.2 QWater | 3.1.8 SentinelHub | 2.0.1 SRTM-Downloader | 3.2.0 qgis_stac | 1.1.1 GeoCoding | 2.19 latlontools | 3.6.14 qfieldsync | v4.6.0 OpenTopography-DEM-Downloader | 2.0 qgis_geonode | 1.0.1 pgtopoeditor | 0.3.0 qgis_resource_sharing | 1.0.0 parcel_plugin | 3.8 lizmap | 3.16.4 create_layer_from_selected_features | 1.2 LDMP | 2.1.14 Projestions | 1.0.1 tile_plus | 0.1 mmqgis | 2021.9.10 copy_coords | 0.3 project_colors_dock | 1.0.0 coordinate_capture | 0.2 geocatbridge | 4.4 sg-diagram-downloader | 3.2 processing | 2.12.99 grassprovider | 2.12.99 db_manager | 0.1.20 MetaSearch | 0.3.6 Mergin | 2023.3 QGIS version 3.32.0-Lima QGIS code revision [b9862de816](https://github.com/qgis/QGIS/commit/b9862de816) Qt version 5.15.2 Python version 3.9.5 GDAL/OGR version 3.3.2 PROJ version 8.1.1 EPSG Registry database version v10.028 (2021-07-07) GEOS version 3.9.1-CAPI-1.14.2 SQLite version 3.35.2 PDAL version 2.3.0 PostgreSQL client version unknown SpatiaLite version 5.0.1 QWT version 6.1.6 QScintilla2 version 2.11.5 OS version macOS 12.6 Active Python plugins ORStools 1.6.0 SemiAutomaticClassificationPlugin 7.10.11 dataset_qa_workbench 0.7.1 pg_metadata 1.2.2 changeDataSource 3.1 quick_map_services 0.19.33 stream_feature_extractor 2.0.0 splitmultipart 1.0.0 cartography_tools 1.2.1 nominatim 1.4.5 linking_relation_editor v1.2.0 QgisModelBaker v7.5.2 QWater 3.1.8 SentinelHub 2.0.1 SRTM-Downloader 3.2.0 qgis_stac 1.1.1 GeoCoding 2.19 latlontools 3.6.14 qfieldsync v4.6.0 OpenTopography-DEM-Downloader 2.0 qgis_geonode 1.0.1 pgtopoeditor 0.3.0 qgis_resource_sharing 1.0.0 parcel_plugin 3.8 lizmap 3.16.4 create_layer_from_selected_features 1.2 LDMP 2.1.14 Projestions 1.0.1 tile_plus 0.1 mmqgis 2021.9.10 copy_coords 0.3 project_colors_dock 1.0.0 coordinate_capture 0.2 geocatbridge 4.4 sg-diagram-downloader 3.2 processing 2.12.99 grassprovider 2.12.99 db_manager 0.1.20 MetaSearch 0.3.6 Mergin 2023.3 ### Supported QGIS version - [X] I'm running a supported QGIS version according to [the roadmap](https://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule). ### New profile - [ ] I tried with a new [QGIS profile](https://docs.qgis.org/latest/en/docs/user_manual/introduction/qgis_configuration.html#working-with-user-profiles) ### Additional context _No response_
jef-n commented 12 months ago

Looks successful. Have you checked whether you have a table "public"."public.input"?

gubuntu commented 12 months ago

you're right thanks, it did work, though my input layer was not called 'input'. I was expecting it to default to my actual input layer name in the QGIS ToC, not the file name of the temporary layer on disc. Which might be a separate issue with the tool?