db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (DERBY-6378) OFFSET/FETCH NEXT ignored when query is enclosed in parentheses
Date Wed, 16 Oct 2013 19:29:43 GMT

    [ https://issues.apache.org/jira/browse/DERBY-6378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13797148#comment-13797148
] 

Dag H. Wanvik edited comment on DERBY-6378 at 10/16/13 7:28 PM:
----------------------------------------------------------------

Attaching a patch which solves the problem. From my sandbox commit log:

Patch derby-6378-1. A cursor node is generated in another way here than normal since the top
level is an expression, and the ORDER BY and offset/fetch info is attached to the SELECT at
the outset, rather than to the CursorNode.

The issue was that the generated cursor node's (empty) offset/fetch got pushed onto the SELECT's
versions in this case, effectively clobbering them. The patch adds checks for null as is done
for ORDER BY and this solved the problem. Added a new test case to OffsetFetchNextTest.



was (Author: dagw):
Attaching a patch which solves the problem. From my sandbox commit log:

Patch derby-6378-1. A cursor node is generated in another ways here than normal since the
top level is an expression, and the ORDER BY and offset/fetch info is attached to the SELECT
at the outset, rather than to the CursorNode.

The issue was that the generated cursor node's (empty) offset/fetch got pushed onto the SELECT's
versions in this case, effectively clobbering them. The patch adds checks for null as is done
for ORDER BY and this solved the problem. Added a new test case to OffsetFetchNextTest.


> OFFSET/FETCH NEXT ignored when query is enclosed in parentheses
> ---------------------------------------------------------------
>
>                 Key: DERBY-6378
>                 URL: https://issues.apache.org/jira/browse/DERBY-6378
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.10.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Dag H. Wanvik
>         Attachments: derby-6378-1.diff
>
>
> ij version 10.10
> ij> connect 'jdbc:derby:memory:db;create=true';
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t values 1,2,3;
> 3 rows inserted/updated/deleted
> ij> select * from t offset 1 row fetch first 1 row only;
> X          
> -----------
> 2          
> 1 row selected
> ij> (select * from t offset 1 row fetch first 1 row only);
> X          
> -----------
> 1          
> 2          
> 3          
> 3 rows selected
> I would have expected that both of the queries had returned a single row.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message