Opened 17 years ago

Closed 15 years ago

#1823 closed defect (fixed)

ogr2ogr import to mysql produces sql with 'natural' keyword

Reported by: nickb Owned by: Mateusz Łoskot
Priority: low Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords: mysql sql keywords
Cc: warmerdam, hobu

Description

ogr2ogr (gdal-bin Version: 1.3.2-2ubuntu1 installed with apt) produces SQL statements that include MySQL's 'natural' keyword, causing an error from MySQL eg:

ALTER TABLE nicks_test_data ADD COLUMN natural VARCHAR(32)

Change History (4)

comment:1 by warmerdam, 17 years ago

Cc: warmerdam hobu added
Keywords: sql keywords added; ogr2ogr natural removed
Milestone: 1.5.0
Owner: changed from warmerdam to Mateusz Łoskot
Priority: normallow

Mateusz,

Could you review our options to resolve this in a reasonable general way? Perhaps if we quote field names sql keyword conflicts won't matter? Alternatively, perhaps we should have an sql keyword list and launder conflicting field and table names?

We can defer this to 1.6 if it looks too involved before 1.5.

comment:2 by hobu, 16 years ago

Milestone: 1.5.01.6.0

It appears the user's data has a field called 'natural', and this is why it is attempting to be created.

Maintaining a keyword list to check against adds lots of work, especially if we're expected to maintain it across all of the various MySQL versions. IMO, the solution is to leave the error as is and the user must rename their column(s) to not be SQL keywords.

comment:3 by Mateusz Łoskot, 16 years ago

Status: newassigned

comment:4 by Even Rouault, 15 years ago

Milestone: 1.6.1
Resolution: fixed
Status: assignedclosed

During GDAL 1.6.0 development, column quoting was added so it is now possible to have a 'natural' column in a MySQL database.

Note: See TracTickets for help on using tickets.