#19058 closed Bug (fixed)
Inserting NULL value in Oracle spatial backend causes crash.
Reported by: | Jani Tiainen | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.4 |
Severity: | Normal | Keywords: | gis oracle orm |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Seem to be regression of #10888.
Main issue is that when inserting or updating spatial field value cx_Oracle interpreted NULL value for SDO_GEOMETRY field when placeholder (%s) as a CHAR. (since it's Oracle user type actually). Both insert and update failed.
As a solution it was implemented so that when ever encountering None value for geometry field placeholder and actual value was removed from the whole insert clause.
Change History (8)
comment:1 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 12 years ago
First, there is a way to install Oracle "full edition" with spatial support using https://code.djangoproject.com/wiki/OracleSpatialTestSetup
The current proposal is to alter the code around line 890 in sql/compiler.py from:
else: placeholders = [ [self.placeholder(field, v) for field, v in zip(fields, val)] for val in values ]
to
else: placeholders = [ [self.placeholder(field, v) for field, v in zip(fields, val)] for val in values ] # Oracle GIS needs to remove some values due to #10888 values = connection.ops.modify_insert_values(placeholders, values)
Default implementation of modify_insert_values is to just return values, Oracle gis would need to loop the placeholders and values in sync and remove values for 'NULL' placeholders.
This way we could fix this issue, and also get rid of Oracle GIS compiler.py.
comment:3 by , 12 years ago
Initial implementation as discussed above:
https://github.com/jtiai/django/commit/a5ebc25
There is still quite a bunch of tests failing on Oracle.
comment:4 by , 12 years ago
I am going to push the patch pretty much as is. Even if Oracle GIS is still broken after this to me it seems like one step in the right direction. We can't break Oracle GIS, and I can't see how this could break anything else. So, I will push this to 1.4.x on the grounds that this is a crash-fix for Oracle GIS.
comment:5 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Marking this as accepted based on IRC discussions. I don't have spatial Oracle available, so I am relying on reporting alone.