You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metamodel.apache.org by "Dennis Du Krøger (JIRA)" <ji...@apache.org> on 2017/08/22 14:40:00 UTC

[jira] [Created] (METAMODEL-1161) Max rows doesn't work on Oracle without offset and ORDER BY

Dennis Du Krøger created METAMODEL-1161:
-------------------------------------------

             Summary: Max rows doesn't work on Oracle without offset and ORDER BY
                 Key: METAMODEL-1161
                 URL: https://issues.apache.org/jira/browse/METAMODEL-1161
             Project: Apache MetaModel
          Issue Type: Bug
    Affects Versions: 4.5.4
            Reporter: Dennis Du Krøger
            Priority: Critical


On Oracle, the query rewriting is completely broken for max rows, unless an offset and ORDER BY clause is also specified, and the version is 12.1.

This seems to stem from the fix for METAMODEL-1132, which made a new OffsetFetchQueryRewriter and then extended OracleQueryRewriter and SQLServerQueryRewriter on top, but is unfortunately missing quite a bit of checks before concluding that `isMaxRowsSupported` should return true: no version check, and no checking that the query actually has the needed clauses set.

The {{SQLServerQueryRewriter}} is not affected, since it  has code to rewrite the SELECT clause.

h5. Reproduction
Query an Oracle datastore with e.g.
{code}
context.query().from("tablename").selectAll().maxRows(10).execute()
{code}
and print the resulting dataset.

h5. Expected result
Only 10 records in the dataset

h5. Actual result
All records are in the dataset



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)