Closed chrisvwn closed 4 years ago
Hi and thanks for submitting this issue. It turned out to be a lot of things going on here. Firstly, the uppercase letters in field-, table- and schema names were not lowercased in the code. However, PostgreSQL will lowercase any non-quoted names, hence - since quoted field names are indeed case sensitive - errors will arise due to the mismatch. Secondly, I also encountered problems with string literal escaping. Sosicon used the old-fashioned backslash character to escape single quotes within text fields. This is now corrected to the recommended double-quoting instead. Thirdly, The initial "SET NAMES [...]" directive at the top of the exported SQL file caused character set problems when the original file was already UTF-8 encoded. Hopefully, these issues have now been fixed and will be commited to the master branch shortly.
Great! Thank you!
Confirming this is fixed! Thanks again!
Hi,
Thanks for this useful tool.
I am trying to import a sosi file into psql using sosicon but receiving errors like below:
After some digging around it seems that sosicon -2psql is generating SQL where table names are sometimes quoted and sometimes not. In particular the
SELECT AddGeometryColumn
single-quotes table names which seems to be translated to a double quoted table name in theALTER TABLE
statement. This causes errors for example:This is a section of the sql file generated using sosicon -2psql showing the create table sections (emphasis is mine):
Manually running this gives the following:
Which is quite right because the table was generated with a lowercase name which I believe is because it was not quoted in the create table statement whle the
ALTER TABLE
statement above uses the quoted table name:I believe this will also affect the geometry column in the insert statements where it is not quoted:
This is with postgres 11 on Debian 4.9.