Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

OSM key natural violates mysql keywords #535

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 4 comments
Closed

OSM key natural violates mysql keywords #535

openstreetmap-trac opened this issue Jul 23, 2021 · 4 comments

Comments

@openstreetmap-trac
Copy link

Reporter: nickblack1[at]gmail.com
[Submitted to the original trac issue database at 10.37am, Wednesday, 12th September 2007]

'natural' is a reserved word for MySQL, so if you import to pgsql using osm2pgsql, then import to mysql, mysql gives errors on the 'natural' column.

Perhaps we should change natural to natural_ or something.

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 3.40pm, Wednesday, 12th September 2007]

osm2pgsql issue.

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 3.44pm, Wednesday, 12th September 2007]

I may be being dense here, but isn't the answer just to quote the column names when inserting into mysql?

@openstreetmap-trac
Copy link
Author

Author: jburgess[at]uklinux.net
[Added to the original trac issue at 6.39pm, Wednesday, 12th September 2007]

It works with the appropriate quoting:

mysql> create table test ( natural int4 );
[[BR]]Query OK, 0 rows affected (0.02 sec)

Or if you enable ANSI SQL mode on the server it will accept " for quotes.

I think you need to do some text processing on the intermediate SQL or find the appropriate options in your export/import tools.

@openstreetmap-trac
Copy link
Author

Author: jburgess[at]uklinux.net
[Added to the original trac issue at 6.42pm, Wednesday, 12th September 2007]

Oops, seems the wiki stripped the quote characters.

You need to use backticks around natural in mysql.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant