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

import errors bag-laatst.backup #217

Closed
whohoho opened this issue Apr 17, 2017 · 6 comments
Closed

import errors bag-laatst.backup #217

whohoho opened this issue Apr 17, 2017 · 6 comments

Comments

@whohoho
Copy link

whohoho commented Apr 17, 2017

Hi,

When importing the bag dump in postgresql, i am getting some errors (and some tables are empty)

pg_restore --no-owner --no-privileges -d gis bag-laatst.backup

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 3561; 0 967968607 TABLE DATA nummeraanduiding kademo
pg_restore: [archiver (db)] COPY failed for table "nummeraanduiding": ERROR: value too long for type character varying(20)
CONTEXT: COPY nummeraanduiding, line 2651304, column documentnummer: "15 � 18393 � 7102"
pg_restore: [archiver (db)] Error from TOC entry 3559; 0 967968585 TABLE DATA openbareruimte kademo
pg_restore: [archiver (db)] COPY failed for table "openbareruimte": ERROR: value too long for type character varying(20)
CONTEXT: COPY openbareruimte, line 53251, column documentnummer: "WD 901 Dr. Ariënsstr"
pg_restore: [archiver (db)] Error from TOC entry 3569; 0 967968689 TABLE DATA pand kademo
pg_restore: [archiver (db)] COPY failed for table "pand": ERROR: value too long for type character varying(20)
CONTEXT: COPY pand, line 4221987, column documentnummer: "BvB 22052011 Blok 9¿"
pg_restore: [archiver (db)] Error from TOC entry 3567; 0 967968661 TABLE DATA verblijfsobject kademo
pg_restore: [archiver (db)] COPY failed for table "verblijfsobject": ERROR: value too long for type character varying(20)
CONTEXT: COPY verblijfsobject, line 3317543, column documentnummer: "14 � 17478 � 4183"
WARNING: errors ignored on restore: 4

@justb4
Copy link
Contributor

justb4 commented Apr 19, 2017

Lijkt alsof alle foutmeldingen met "vreemde characters" te maken hebben. BAG is UTF-8 character encoding. Is dat ook de encoding van je database? btw: er staat net een nieuwe bag-laatst op data.nlextract.nl.

@Vic-s
Copy link

Vic-s commented Apr 29, 2017

Daar had ik eerder ook al last van.
https://groups.google.com/forum/#!topic/nlextract/QsnEmiQ4Zso
Handmatig het ik de dump aangepast en het veld naar 40 karakters gezet, dan werkt de restore wel goed.
sed 's/documentnummer character varying(20)/documentnummer character varying(40)/g' <in DB> > <out DB>

@justb4
Copy link
Contributor

justb4 commented May 1, 2017

Blijf dit vreemd vinden: heb zelf net zonder problemen http://data.nlextract.nl/bag/postgis/bag-laatst.backup geimporteerd. Ook volgens de BAG standaard (GML XSD) zijn documentnummer velden altijd 20 karakters. Ik weet daarom bijna zeker dat het bij jullie gaat om een mismatch tussen de character-encoding in de BAG-dump (UTF-8) en de character-encoding setting in de database (op windows vaak: Windows-1252 of CP-1252, 1-byte). Dan gaat het fout bij tekens die in UTF-8 1 character zijn, maar in Windows-1252 meerdere, vooral bij "speciale tekens" (zie boven).
Naar 40 karakters zetten zal bovendien andere problemen geven bij speciale tekens (umlauts, Fries etc) in bijv straatnamen. Kijk nog eens goed in je Postgres DB configuratie wat de character set van de DB instantie is. Die is nl ook te wijzigen...

@whohoho
Copy link
Author

whohoho commented May 2, 2017

Hier was het probleem idd opgelost door een UTF-8 database aan te maken.

Voor het wijzigen van de characterset encoding moet je de database opnieuw importeren, dus het is mischien wel handig om in de documentatie duidelijk aan te geven dat er een UTF-8 database gebruikt moet worden.

@Vic-s
Copy link

Vic-s commented May 2, 2017

ja bedankt! De default database is bij mij SQL_ASCII encoded.

createdb <..> -E UTF8

lost dit op.

@justb4
Copy link
Contributor

justb4 commented May 3, 2017

Documentatie op http://docs.nlextract.nl/en/latest/bagextract.html is aangepast.

@justb4 justb4 closed this as completed May 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants