Skip to content

ORA-00907 : missing right parenthesis #7362

Open

Description

@pelord

*** Seem to be related to #7312 ***
For @jmckenna : I could not reopen the issue.

With Mapserver 8.4.1,

When applying WMS Vendor specific filter on an Oracle Layer, in insensitive mode, a extra parenthesis seem to be added.

Here the applied filter

FILTER=(<Filter xmlns="http://www.opengis.net/ogc"><PropertyIsEqualTo matchCase="false"><PropertyName>DIRECTION</PropertyName><Literal>N</Literal></PropertyIsEqualTo></Filter>)

Here a part of debug log (DEBUG 5). I have remove some parts of the SQL, by I've kept the WHERE clause.


SELECT DIRECTION,rownum, GEOM,myid 


 FROM MY_TABLE WHERE  ( REGEXP_LIKE( DIRECTION, '^N$'),'i'  ) )  


AND SDO_FILTER( .....)

This query contain an extra ) before the 'i' in the clause.

It's look like it is relate to the match case property because it is working properly with matchCase set to true.

Here my layer definition. I've tried with a direct acces to the table and with a subselect. Same result

ENCODING "WINDOWS-1252"
CONNECTIONTYPE ORACLESPATIAL
CONNECTION "USER/{ENCRYPTED_PWD}@TNSNAME" 
PROCESSING "CLOSE_CONNECTION=DEFER"
DATA "GEOM from  MY_TABLE using unique myid SRID 3798"

Activity

  1. jmckenna commented on Oct 15, 2025

    @jmckenna
    Member

    sorry for the hassle @pelord I now reopened that other issue

  2. jmckenna commented on Nov 7, 2025

    @jmckenna
    Member

    @pelord does PR #7379 also solve your issue here?

  3. jmckenna commented on Nov 10, 2025

    @jmckenna
    Member

    @pelord any luck in finding the fix for this?

  4. pelord commented on Nov 11, 2025

    @pelord
    ContributorAuthor

    This afternoon :)

  5. jmckenna commented on Nov 11, 2025

    @jmckenna
    Member

    that would be good timing, thanks again.

  6. pelord commented on Nov 11, 2025

    @pelord
    ContributorAuthor

    I compile it tomorrow morning and I give you some feedback in the morning. Sorry for the delay!

  7. pelord commented on Nov 11, 2025

    @pelord
    ContributorAuthor

    seem to be related to this change

    a468ec9

  8. pelord commented on Nov 11, 2025

    @pelord
    ContributorAuthor

    @mikitex70 Any test / use case for your change?

  9. pelord commented on Nov 11, 2025

    @pelord
    ContributorAuthor

    It's look like your change trigger this problem and if I remove your change, your will get your problem back! :(

  10. mikitex70 commented on Nov 12, 2025

    @mikitex70
    Contributor

    I work mainly with Oracle databases and I've found that the MapServer expression parser isn't so good.
    I've found that the best workaround for the missing right parenthesis is to write the FILTER expression with extra parenthesis around it, like:

    FILTER (('[field'] =* 'Value'))
    

    If the expression is like '[field]' =* 'Value' MapServer converts it to REGEXP_LIKE( "FIELD", '^Value$','i' , without the closing parenthesis.
    This kind of workaround works for every expression the uses like/regex operators.

    My patch fixes some issues, but it doesn't always work and may introduce some other error in the conversion.
    The best thing is to revise/refactor the expression parser, maybe using yacc or similar tools. I don't think they will introduce major slowdowns, and expressions would always be analyzed correctly.

  11. pelord commented on Nov 12, 2025

    @pelord
    ContributorAuthor

    But could you provide me an use case, how to trigger your syntax.

    in my case, i've used

    FILTER=(<Filter xmlns="http://www.opengis.net/ogc"><PropertyIsEqualTo matchCase="false"><PropertyName>DIRECTION</PropertyName><Literal>N</Literal></PropertyIsEqualTo></Filter>)
    
  12. mikitex70 commented on Nov 12, 2025

    @mikitex70
    Contributor

    Try

    FILTER=((<Filter xmlns="http://www.opengis.net/ogc"><PropertyIsEqualTo matchCase="false"><PropertyName>DIRECTION</PropertyName><Literal>N</Literal></PropertyIsEqualTo></Filter>))
    

    Maybe the parser works as the Oracle parser with the FILTER directive in map files ...

    I work with different databases at the same time (Oracle, PostgreSQL, MySQL and MongoDB) but I have never tested a similar use case, I need to do some testing.

  13. pelord commented on Dec 16, 2025

    @pelord
    ContributorAuthor

    My local fix is working properly. But it's a kind of revert of the previous commit...

    a468ec9

       if (ieq == MS_TRUE) {
              // native_string = msStringConcatenate(native_string, ")");
              msDebug("Handling of MapServer/issues/7362\n");
              ieq = MS_FALSE;
      }
    
    

    Any advice/opinion how to resolve issue? How to reconciliate these issues?

  14. mikitex70 commented on Dec 16, 2025

    @mikitex70
    Contributor

    I think it's okay to revert the patch (it's mine), it doesn't always work.
    But as I wrote above, there are problems in the entire expression parser, in some cases (with operators with regular expressions) I am forced to add extra parentheses to ensure that they are translated correctly.
    I suppose the current implementation was designed to be fast, but perhaps a traditional parser, implemented with yacc or similar tools, could be fast enough and would make the code more maintainable and correct.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions