Skip to content

Error in oracle select, space missing #7312

Closed

Description

@gkvoelkl

Hello,

In mapserver 8.4.0 I am getting this error message

Wed Jul 23 10:15:54 2025].540224 Error: ORA-00907: Rechte Klammer fehlt
. Query statement: SELECT SDO_AGGR_MBR(geom) AS GEOM from (SELECTgeom FROM (select * from Test )) .Check your data statement.in msOracleSpatialLayerGetExtent()
[Wed Jul 23 10:15:54 2025].540256 msOracleSpatialLayerGetExtent(): OracleSpatial error. Check your data statement and server logs

The statement is generated by mapserver. A space is missing SELECTgeom

Please change this.

Best regards Gerhard

Activity

  1. jratike80 commented on Jul 29, 2025

    @jratike80

    Have you set LAYER EXTENT for the Oracle layer? I believe that if it is set, then Mapserver does not generate the SELECT SDO_AGGR_MBR(geom) query at all. It is a very slow query with big tables anyway.

  2. gkvoelkl commented on Jul 29, 2025

    @gkvoelkl
    Author

    After MAP I set EXTEND. I think it will work for all layers in the map file.

  3. jratike80 commented on Jul 29, 2025

    @jratike80

    Please have a try and set the extent explicitly for your layer https://mapserver.org/mapfile/layer.html.

    The spatial extent of the data. In most cases you will not need to specify this, but it can be used to avoid the speed cost of having MapServer compute the extents of the data. An application can also possibly use this value to override the extents of the map.

  4. jratike80 commented on Aug 14, 2025

    @jratike80

    Hi @gkvoelkl , did you try the workaround by setting the layer level extent?

  5. jmckenna commented on Oct 2, 2025

    @jmckenna
    Member

    Closing to due inactivity. Please re-open if there is a problem.

  6. samy-rd commented on Nov 3, 2025

    @samy-rd

    Hello

    I also stumbled uppon the problem while using SWIG Api's layerObj->getExtent() function. The error is the same as @gkvoelkl stated.

    I've looked into the Mapserver function osAggrGetExtent in /src/maporaclespatial.c.
    I found that the function is not working properly if the corresponding layer/layerObj has no items (layerObj->numItems = 0).
    If there is no Items, then the concatinated String is missing a space and the error occurs.

    Comparing the function osAggrGetExtent from Mapserver 7.4 to 8.4 you can also see the following:

    MS 7.4 : /maporaclespatial.c : line 1068
    snprintf( query_str2 + strlen(query_str2), sizeof(query_str2)-strlen(query_str2), " %s FROM %s", geom_column_name, table_name);
    Here there's a preceiding Space Character before %s FROM %s => Works, even if layerObj->numitems = 0

    MS 8.4 : /src/maporaclespatial.c : line 1220
    snprintf(tmpFrom, tmpFromSize, "%s FROM %s", geom_column_name, table_name);
    Here there's no preceiding Space Character before %s FROM %s => Does not work if layerObj->numitems = 0

    I would propose that the issue could be fixed by only adding a preceiding Space character before "%s FROM %s" in /src/maporaclespatial.c:line 1220.

    I hope this helps. Thank you very much for all your effort!

    Best regards
    Samy

  7. jmckenna commented on Nov 3, 2025

    @jmckenna
    Member

    @msmitherdc have you come across this missing space issue in your Oracle queries?

  8. added theissue type on Nov 3, 2025
  9. added this to the 8.6.0 Release milestone on Nov 4, 2025
  10. jmckenna commented on Nov 6, 2025

    @jmckenna
    Member

    @samy-rd are you able to create a pull request with your proposed change? thanks.

  11. msmitherdc commented on Nov 7, 2025

    @msmitherdc
    Contributor

    I agree that the extra space should be added to the function, would you like me to create a PR @jmckenna? I can do that today

  12. samy-rd commented on Nov 7, 2025

    @samy-rd

    Thank you @msmitherdc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions