unusual but trivially reproducible bug

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

unusual but trivially reproducible bug

Robert Cousins
Summary:
      Leaving out the space after the word 'limit' causes the limit
clause to be ignored.
    I've reproduced it on version 3.19.2 2017-05-25 16:50:27
edb4e819b0c058c7d74d27ebd14cc5ceb2bad6a6144a486a970182b7afe3f8b9
    A sample output is below.
    On one hand, this is a failure to catch a syntax error. On the other
hand, the fact that it isn't caught is perhaps problematic and indicates
an underlying parser issue.
Thanx

sqlite> create table foo(id Integer not null primary key, bar int);
sqlite> insert into foo values (NULL,1),(NULL,2),(NULL,3);
sqlite> select * from foo limit1;
id          bar      
----------  ----------
1           1        
2           2        
3           3        
sqlite> select * from foo limit2;
id          bar      
----------  ----------
1           1        
2           2        
3           3        
sqlite> select * from foo limit 1;
id          bar      
----------  ----------
1           1        
sqlite> select * from foo limit 2;
id          bar      
----------  ----------
1           1        
2           2        
sqlite>

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unusual but trivially reproducible bug

Scott Robison-2
Not a bug. Instead of a keyword, you've defined an alias for the table
named "limit1".

On Jun 19, 2017 4:00 AM, "Robert Cousins" <[hidden email]> wrote:

> Summary:
>       Leaving out the space after the word 'limit' causes the limit
> clause to be ignored.
>     I've reproduced it on version 3.19.2 2017-05-25 16:50:27
> edb4e819b0c058c7d74d27ebd14cc5ceb2bad6a6144a486a970182b7afe3f8b9
>     A sample output is below.
>     On one hand, this is a failure to catch a syntax error. On the other
> hand, the fact that it isn't caught is perhaps problematic and indicates
> an underlying parser issue.
> Thanx
>
> sqlite> create table foo(id Integer not null primary key, bar int);
> sqlite> insert into foo values (NULL,1),(NULL,2),(NULL,3);
> sqlite> select * from foo limit1;
> id          bar
> ----------  ----------
> 1           1
> 2           2
> 3           3
> sqlite> select * from foo limit2;
> id          bar
> ----------  ----------
> 1           1
> 2           2
> 3           3
> sqlite> select * from foo limit 1;
> id          bar
> ----------  ----------
> 1           1
> sqlite> select * from foo limit 2;
> id          bar
> ----------  ----------
> 1           1
> 2           2
> sqlite>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unusual but trivially reproducible bug

Ketil Froyn
In reply to this post by Robert Cousins
It's not a bug, you're setting up a table alias called "limit2". The
"AS" keyword is optional, but this is the same as:

select * from foo AS limit1;

Ketil

On 18 June 2017 at 21:19, Robert Cousins <[hidden email]> wrote:

> Summary:
>       Leaving out the space after the word 'limit' causes the limit
> clause to be ignored.
>     I've reproduced it on version 3.19.2 2017-05-25 16:50:27
> edb4e819b0c058c7d74d27ebd14cc5ceb2bad6a6144a486a970182b7afe3f8b9
>     A sample output is below.
>     On one hand, this is a failure to catch a syntax error. On the other
> hand, the fact that it isn't caught is perhaps problematic and indicates
> an underlying parser issue.
> Thanx
>
> sqlite> create table foo(id Integer not null primary key, bar int);
> sqlite> insert into foo values (NULL,1),(NULL,2),(NULL,3);
> sqlite> select * from foo limit1;
> id          bar
> ----------  ----------
> 1           1
> 2           2
> 3           3
> sqlite> select * from foo limit2;
> id          bar
> ----------  ----------
> 1           1
> 2           2
> 3           3
> sqlite> select * from foo limit 1;
> id          bar
> ----------  ----------
> 1           1
> sqlite> select * from foo limit 2;
> id          bar
> ----------  ----------
> 1           1
> 2           2
> sqlite>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



--
-Ketil
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unusual but trivially reproducible bug

Richard Hipp-3
In reply to this post by Robert Cousins
On 6/18/17, Robert Cousins <[hidden email]> wrote:
> Summary:
>       Leaving out the space after the word 'limit' causes the limit
> clause to be ignored.

Not a syntax error.  Omitting the space makes the parser think that
"limit1" is an alias for the final table name - the equivalent of:

   SELECT * FROM foo AS limit1;

Only, without the (optional) AS keyword.

>     I've reproduced it on version 3.19.2 2017-05-25 16:50:27
> edb4e819b0c058c7d74d27ebd14cc5ceb2bad6a6144a486a970182b7afe3f8b9
>     A sample output is below.
>     On one hand, this is a failure to catch a syntax error. On the other
> hand, the fact that it isn't caught is perhaps problematic and indicates
> an underlying parser issue.
> Thanx
>
> sqlite> create table foo(id Integer not null primary key, bar int);
> sqlite> insert into foo values (NULL,1),(NULL,2),(NULL,3);
> sqlite> select * from foo limit1;
> id          bar
> ----------  ----------
> 1           1
> 2           2
> 3           3
> sqlite> select * from foo limit2;
> id          bar
> ----------  ----------
> 1           1
> 2           2
> 3           3
> sqlite> select * from foo limit 1;
> id          bar
> ----------  ----------
> 1           1
> sqlite> select * from foo limit 2;
> id          bar
> ----------  ----------
> 1           1
> 2           2
> sqlite>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unusual but trivially reproducible bug

Hick Gunter
In reply to this post by Robert Cousins
Limit2 is taken to be the alias of table foo.

-----Urspr√ľngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Robert Cousins
Gesendet: Sonntag, 18. Juni 2017 21:19
An: [hidden email]
Betreff: [sqlite] unusual but trivially reproducible bug

Summary:
      Leaving out the space after the word 'limit' causes the limit clause to be ignored.
    I've reproduced it on version 3.19.2 2017-05-25 16:50:27
edb4e819b0c058c7d74d27ebd14cc5ceb2bad6a6144a486a970182b7afe3f8b9
    A sample output is below.
    On one hand, this is a failure to catch a syntax error. On the other hand, the fact that it isn't caught is perhaps problematic and indicates an underlying parser issue.
Thanx

sqlite> create table foo(id Integer not null primary key, bar int);
sqlite> insert into foo values (NULL,1),(NULL,2),(NULL,3); select * from
sqlite> foo limit1;
id          bar
----------  ----------
1           1
2           2
3           3
sqlite> select * from foo limit2;
id          bar
----------  ----------
1           1
2           2
3           3
sqlite> select * from foo limit 1;
id          bar
----------  ----------
1           1
sqlite> select * from foo limit 2;
id          bar
----------  ----------
1           1
2           2
sqlite>

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: [hidden email]

This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation.


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Loading...