Opened 12 years ago

Last modified 12 years ago

#4128 reopened defect

Oracle paging fails with ORA-01445

Reported by: bartvde Owned by: mapserverbugs
Priority: normal Milestone:
Component: WFS Server Version: 6.0
Severity: normal Keywords: oracle wfs paging none data statement
Cc: yassefa, msmitherdc

Description

A DATA statement with NONE, e.g.:

DATA "GEOMETRY FROM (SELECT GID, CONTRACTNR, VERVALLEN, WEG, BAAN, STROOK, HM_VANAF, HM_TOT, DEKLAAG, AANTAL_LAGEN, BONUS, MALUS, BONUSVERVALLEN, EINDDAT, INGANGSDATUM, MEETMOMENT1, MEETMOMENT2, OPMERKING, DISTRICTNAAM, DISTRICT, GEOMETRY FROM GARANTIEBANK.GBA_V_VERHARDING2) USING UNIQUE GID NONE"

will result in the following ORA error when doing a WFS GetFeature request with startindex:

msWFSGetFeature(): WFS server error. ms_error->code not found msOracleSpatialLayerWhichShapes(): OracleSpatial error. Error: ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table

. Query statement: SELECT * from (SELECT atmp.*, ROWNUM rnum from (SELECT GID, CONTRACTNR, VERVALLEN, WEG, BAAN, STROOK, HM_VANAF, HM_TOT, DEKLAAG, AANTAL_LAGEN, BONUS, MALUS, BONUSVERVALLEN, EINDDAT, INGANGSDATUM, MEETMOMENT1, MEETMOMENT2, OPMERKING, DISTRICTNAAM, DISTRICT, rownum, GEOMETRY FROM (SELECT GID, CONTRACTNR, VERVALLEN, WEG, BAAN, STROOK, HM_VANAF, HM_TOT, DEKLAAG, AANTAL_LAGEN, BONUS, MALUS, BONUSVERVALLEN, EINDDAT, INGANGSDATUM, MEETMOMENT1, MEETMOMENT2, OPMERKING, DISTRICTNAAM, DISTRICT, GEOMETRY FROM GARANTIEBANK.GBA_V_VERHARDING2) order by rowid) atmp where ROWNUM<=9) where rnum >=5 . Check your data statement.

msQueryByRect(): Search returned no results. No matching record(s) found.

http://ontwikkel.intranet.rijkswaterstaat.nl/services/geoservices/60/project/garantiebank/garantiebank?service=WFS&request=GetFeature&maxfeatures=5&typename=GARBANK001&version=1.1.0&startindex=5

Change History (4)

comment:1 by bartvde, 12 years ago

Resolution: invalid
Status: newclosed

I am closing this one, this is more to do with Oracle than with Mapserver.

comment:2 by bartvde, 12 years ago

Cc: yassefa added
Resolution: invalid
Status: closedreopened
Summary: when using NONE in DATA statement, Oracle paging failsOracle paging fails with ORA-01445

Okay after a bit more research I am reopening.

Seems that the "order by rowid" is causing the issue, and I am not really sure why Mapserver needs to include this in a paging query? Assefa, do you remember why this was necessary?

comment:3 by assefa, 12 years ago

Cc: msmitherdc added

Hi Bart,

From what I remember is that the return set of results is not always guaranteed to be in the same order for the same query. Ordering by rowid would make sure the results are always ordered the same way, thus allowing correct pagination.

I have added Mike in cc to see if this makes sense.

comment:4 by msmitherdc, 12 years ago

Correct. Query order is not consistent unless there is an order by in the query.

Note: See TracTickets for help on using tickets.