Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ogr2ogr: WFS string maxLength causes postgres error #1508

Closed
magnus-m opened this issue May 6, 2019 · 1 comment
Closed

ogr2ogr: WFS string maxLength causes postgres error #1508

magnus-m opened this issue May 6, 2019 · 1 comment
Assignees
Labels
Milestone

Comments

@magnus-m
Copy link

magnus-m commented May 6, 2019

Expected behavior and actual behavior.

Expected behavior
ogr2ogr will take the content of a feature from a WFS-service and create a corresponding table in PostgreSQL, where the data is stored.

Actual behavior
ogr2ogr tries to create a varchar column with a max length that exceeds the max length allowed by PostgreSQL, with the following error:

ERROR: ALTER TABLE "schema_name"."tabel_name" ADD COLUMN "column_name" VARCHAR(1073741822)
ERROR: length for type varchar cannot exceed 10485760

Steps to reproduce the problem.

Have a WFS-service where a feature has a string length exceeding 10485760, which is the max length for VARCHAR in PostgreSQL

Shown here via a DescribeFeatureType command:
objid

The command used:

ogr2ogr.exe --config PG_USE_COPY NO -lco schema=schema_name -a_srs EPSG:25832 -f "PostgreSQL" "PG:user=postgres password=secret dbname=db_name host=localhost port=5432" "WFS:http://url.com/arcgis_server/services/name/name/MapServer/WFSServer?service=WFS&version=1.0.0&token=secret_token" feature_name:name -lco PRECISION=YES -lco LAUNDER=YES -skipfailures -nln tabel_name

Operating system

Windows 10

GDAL version and provenance

GDAL 2.4.0, released 2018/12/14
Tested with both PostgreSQL 9.3 and 10

@rouault rouault closed this as completed in ac8ca30 May 6, 2019
@rouault
Copy link
Member

rouault commented May 6, 2019

You can workaround the issue by adding -unsetFieldWidth

@rouault rouault self-assigned this May 6, 2019
@rouault rouault added the bug label May 6, 2019
@rouault rouault added this to the 2.4.2 milestone May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants