Re: [sqlite] Bug in sqlite: "View with UNION ALL and limit in subquery" (v 3.28.0)

2019-05-29 Thread Richard Hipp
Thank you for the report.  The problem is now fixed on trunk.

Ticket: https://www.sqlite.org/src/info/c41afac34f15781f
Fix: https://www.sqlite.org/src/info/523b42371122d9e1

On 5/29/19, Marco Foit  wrote:
> Dear SQLite Developers,
>
> I just noticed the following bug in SQLite version 3.28.0:
>
> 
>
> create table t AS values (1), (2);
>
> .print "select with correct output  ..."
> select * from ( select * from t limit 1 )
> union all
> select * from t
> ;
>
> .print "same select leads to incorrect result when used inside view ..."
> create view v as
> select * from ( select * from t limit 1 )
> union all
> select * from t
> ;
>
> select * from v;
>
> 
>
>
> * How to reproduce:
> Run the attached SQL code from a shell with:
>
>   sqlite3 < sqlite-bug.sql
>
>
> * Expected result:
> Both queries should yield the following output:
> 1
> 1
> 2
>
> * What did go wrong:
> The second query yields to the output:
> 1
>
>
> It seems that the limit clause in the compound select when used inside a
> view is used for the overall result set and not for the subquery.
>
>
> In the hope that this might help others.
> Thank you very much for your hard work!
>
>
> Cheers,
> Marco
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Bug in sqlite: "View with UNION ALL and limit in subquery" (v 3.28.0)

2019-05-29 Thread Marco Foit

Dear SQLite Developers,

I just noticed the following bug in SQLite version 3.28.0:



create table t AS values (1), (2);

.print "select with correct output  ..."
select * from ( select * from t limit 1 )
union all
select * from t
;

.print "same select leads to incorrect result when used inside view ..."
create view v as
select * from ( select * from t limit 1 )
union all
select * from t
;

select * from v;




* How to reproduce:
Run the attached SQL code from a shell with:

sqlite3 < sqlite-bug.sql


* Expected result:
Both queries should yield the following output:
1
1
2

* What did go wrong:
The second query yields to the output:
1


It seems that the limit clause in the compound select when used inside a 
view is used for the overall result set and not for the subquery.



In the hope that this might help others.
Thank you very much for your hard work!


Cheers,
Marco


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users