15

Using CentOS 8.0 with PostgreSQL 12, PostGIS 3, and GDAL/OGR 3.0.1. I want to append a file to a database table.

Previously (before upgrading to the new system) I used

ogr2ogr -f "PostgreSQL" PG:"dbname=dev user=admin password=123 host=0.0.0.0 port=5432" -lco "SCHEMA=myschema" -lco "GEOMETRY_NAME=geog" -append -sql "select ID as gid from input" input.gen

However, that fails now with

ERROR 1: ERROR: column s.consrc does not exist LINE 1: ...nrelid = c.oid AND a.attnum = ANY (s.conkey) AND (s.consrc L... ^

HINT: Perhaps you meant to reference the column "s.conkey" or the column "s.c onbin".

ERROR 1: ERROR: column s.consrc does not exist LINE 1: ...nrelid = c.oid AND a.attnum = ANY (s.conkey) AND (s.consrc L... ^

HINT: Perhaps you meant to reference the column "s.conkey" or the column "s.c onbin".

ERROR 1: Layer myschema.input already exists, CreateLayer failed. Use the layer creation option OVERWRITE=YES to replace it.

ERROR 1: Terminating translation prematurely after failed translation from sql statement.

If I make a PGDUMP with

ogr2ogr -f "PGDUMP" -lco "SCHEMA=myschema" -lco "GEOMETRY_NAME=geog" -append -sql "select ID as gid from input" test.dump input.gen

I can run that file in psql and import the data, but I would like to avoid that extra step of writing a large pgdump file.

Notes

  • It also fails without -append
  • It fails with other input data types and files as well (Shapefile, ArcGEN, and GeoJSON)
  • Columns mentioned in the Error message are not part of my input data.
  • I suspect that it has something to do with PostgreSQL 12 dropping OID
0

2 Answers 2

11

I have the same issue (this morning) and started to search for some solutions and the only thing I found is that is a GDAL PG12 problem, which was solved in a commit of GDAL in July 2019.

This means we have to fix this manually or upgrade our GDAL. Your GDAL version is from June 2019, mine also.

3
  • Depends of OS, if app/python etc.
    – mazinga
    Commented Apr 10, 2020 at 7:16
  • 1
    Do you know any PPA wich includes this fix in GDAL for Ubuntu 18.04? Commented May 8, 2020 at 14:22
  • 1
    Is there a way to get this bug fix in Debian 10 Buster?
    – thibautg
    Commented May 23, 2020 at 18:43
3

Can confirm that 3.0.1 has the bug, but it is solved in 3.0.2 as mentioned correctly in the comments here by @michael. The version number is important to mention here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.