Skip to content

Commit

Permalink
fixed bug #7486, topn's over referenced relations need to lookup the …
Browse files Browse the repository at this point in the history
…allready constructed relation
  • Loading branch information
njnes committed May 15, 2024
1 parent 7584b1a commit 5dbf31d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 4 additions & 1 deletion sql/backends/monet5/rel_bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -4560,7 +4560,10 @@ rel2bin_topn(backend *be, sql_rel *rel, list *refs)
sql_rel *rl = rel->l;

if (rl->op == op_project) {
sub = rel2bin_project(be, rl, refs, rel);
if (rel_is_ref(rl))
sub = refs_find_rel(refs, rl);
else
sub = rel2bin_project(be, rl, refs, rel);
} else {
sub = subrel_bin(be, rl, refs);
}
Expand Down
4 changes: 1 addition & 3 deletions sql/test/BugTracker-2024/Tests/CMDgen_group-Bug-7486.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ NULL
NULL
NULL

skipif knownfail
query I nosort
WITH x AS ( SELECT * FROM generate_series ( 32989 , 8100 ) EXCEPT SELECT * FROM generate_series ( 44 , 3 ) ) SELECT CASE WHEN NULL IN ( 69 , MAX ( CASE WHEN 97 THEN 66 END ) OVER ( ) + ( SELECT COUNT ( * ) ) ) THEN 41 END FROM x LIMIT 3
----
NULL
NULL
NULL

skipif knownfail
query I nosort
statement error GDK reported error: BATsubcross: more than one match
SELECT ( WITH x AS ( SELECT * FROM generate_series ( 32989 , 8100 ) EXCEPT SELECT * FROM generate_series ( 44 , 3 ) ) SELECT CASE WHEN NULL IN ( 69 , MAX ( CASE WHEN 97 THEN 66 END ) OVER ( ) + ( SELECT COUNT ( * ) ) ) THEN 41 END FROM x )
----

0 comments on commit 5dbf31d

Please sign in to comment.