Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#535 closed enhancement (invalid)

OSM key natural violates mysql keywords

Reported by: nickblack1@… Owned by: jburgess777@…
Priority: minor Milestone:
Component: admin Version:
Keywords: natural mysql pgsql osm2pgsql Cc:


'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.

Change History (4)

comment:1 Changed 13 years ago by Tom Hughes

Owner: changed from Tom Hughes to jburgess777@…

osm2pgsql issue.

comment:2 Changed 13 years ago by Tom Hughes

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

comment:3 Changed 13 years ago by jburgess@…

Resolution: invalid
Status: newclosed

It works with the appropriate quoting:

mysql> create table test ( natural int4 );
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.

comment:4 Changed 13 years ago by jburgess@…

Oops, seems the wiki stripped the quote characters.

You need to use backticks around natural in mysql.

Note: See TracTickets for help on using tickets.