Re: [sqlite] segmentation fault with 3.8.0

2013-08-29 Thread kenichi ishigaki
Thank you for the fix!

Kenichi Ishigaki

2013/8/30 Marc L. Allen <mlal...@outsitenetworks.com>:
> Thanks... that certainly clarifies it.  Also, thanks to Dan who responded 
> similarly.
>
> -Original Message-
> From: sqlite-users-boun...@sqlite.org 
> [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp
> Sent: Thursday, August 29, 2013 11:58 AM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] segmentation fault with 3.8.0
>
> On Thu, Aug 29, 2013 at 11:47 AM, Marc L. Allen <mlal...@outsitenetworks.com
>> wrote:
>
>> Silly question.. I looked at the fix.  Why ignore indexes with greater
>> than 4 fields?  Isn't that a bit risky?  Wouldn't it be better to
>> ignore the fields after the 4th one for planning?
>>
>
> The whereShortCut() routine is merely an optimization.  It provides a quick 
> plan for the common case of a single-table query using an equality constraint 
> on a PRIMARY KEY or UNIQUE index.  Anything that falls through
> whereShortCut() goes into the regular query planner and will get analyzed 
> thoroughly there.
>
> You could omit the whereShortCut() routine entirely and SQLite would still 
> give the correct answer.  The only downside is that sqlite3_prepare_v2() 
> would run slightly slower in the common case.
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
> This email and any attachments are only for use by the intended recipient(s) 
> and may contain legally privileged, confidential, proprietary or otherwise 
> private information. Any unauthorized use, reproduction, dissemination, 
> distribution or other disclosure of the contents of this e-mail or its 
> attachments is strictly prohibited. If you have received this email in error, 
> please notify the sender immediately and delete the original.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] segmentation fault with 3.8.0

2013-08-29 Thread Marc L. Allen
Thanks... that certainly clarifies it.  Also, thanks to Dan who responded 
similarly.

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Richard Hipp
Sent: Thursday, August 29, 2013 11:58 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] segmentation fault with 3.8.0

On Thu, Aug 29, 2013 at 11:47 AM, Marc L. Allen <mlal...@outsitenetworks.com
> wrote:

> Silly question.. I looked at the fix.  Why ignore indexes with greater 
> than 4 fields?  Isn't that a bit risky?  Wouldn't it be better to 
> ignore the fields after the 4th one for planning?
>

The whereShortCut() routine is merely an optimization.  It provides a quick 
plan for the common case of a single-table query using an equality constraint 
on a PRIMARY KEY or UNIQUE index.  Anything that falls through
whereShortCut() goes into the regular query planner and will get analyzed 
thoroughly there.

You could omit the whereShortCut() routine entirely and SQLite would still give 
the correct answer.  The only downside is that sqlite3_prepare_v2() would run 
slightly slower in the common case.
--
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


This email and any attachments are only for use by the intended recipient(s) 
and may contain legally privileged, confidential, proprietary or otherwise 
private information. Any unauthorized use, reproduction, dissemination, 
distribution or other disclosure of the contents of this e-mail or its 
attachments is strictly prohibited. If you have received this email in error, 
please notify the sender immediately and delete the original.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] segmentation fault with 3.8.0

2013-08-29 Thread Dan Kennedy

On 08/29/2013 10:47 PM, Marc L. Allen wrote:

Silly question.. I looked at the fix.  Why ignore indexes with greater than 4 
fields?  Isn't that a bit risky?  Wouldn't it be better to ignore the fields 
after the 4th one for planning?


SQLite 3.8.0 really contains two query planners. The first
(in function whereShortcut()) is very fast but only handles
simple cases. The second takes longer to run but handles much
more complicated queries. So, to speed up sqlite3_prepare_v2(),
SQLite tries to use the first planner as much as possible.

The change just has the first planner ignore such indexes. Any
cases that can benefit from using a primary key or unique index
will be handled by the second planner.










-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Richard Hipp
Sent: Thursday, August 29, 2013 11:38 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] segmentation fault with 3.8.0

On Thu, Aug 29, 2013 at 11:32 AM, Stephen Chrzanowski
<pontia...@gmail.com>wrote:


My guess is single quotes instead of double quotes.  Where exactly is
the seg fault?  Untested but other than the quotes, everything looks fine.


The problem is described here: http://www.sqlite.org/src/info/9f2eb3abac

The fix is here: http://www.sqlite.org/src/info/c1152bdcbb

A patch release 3.8.0.1 that includes this fix and fixes for two other equally 
obscure corner cases is currently in test and is expected to go out later today.

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


This email and any attachments are only for use by the intended recipient(s) 
and may contain legally privileged, confidential, proprietary or otherwise 
private information. Any unauthorized use, reproduction, dissemination, 
distribution or other disclosure of the contents of this e-mail or its 
attachments is strictly prohibited. If you have received this email in error, 
please notify the sender immediately and delete the original.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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


Re: [sqlite] segmentation fault with 3.8.0

2013-08-29 Thread Richard Hipp
On Thu, Aug 29, 2013 at 11:47 AM, Marc L. Allen  wrote:

> Silly question.. I looked at the fix.  Why ignore indexes with greater
> than 4 fields?  Isn't that a bit risky?  Wouldn't it be better to ignore
> the fields after the 4th one for planning?
>

The whereShortCut() routine is merely an optimization.  It provides a quick
plan for the common case of a single-table query using an equality
constraint on a PRIMARY KEY or UNIQUE index.  Anything that falls through
whereShortCut() goes into the regular query planner and will get analyzed
thoroughly there.

You could omit the whereShortCut() routine entirely and SQLite would still
give the correct answer.  The only downside is that sqlite3_prepare_v2()
would run slightly slower in the common case.
-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] segmentation fault with 3.8.0

2013-08-29 Thread Marc L. Allen
Silly question.. I looked at the fix.  Why ignore indexes with greater than 4 
fields?  Isn't that a bit risky?  Wouldn't it be better to ignore the fields 
after the 4th one for planning? 

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Richard Hipp
Sent: Thursday, August 29, 2013 11:38 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] segmentation fault with 3.8.0

On Thu, Aug 29, 2013 at 11:32 AM, Stephen Chrzanowski
<pontia...@gmail.com>wrote:

> My guess is single quotes instead of double quotes.  Where exactly is 
> the seg fault?  Untested but other than the quotes, everything looks fine.
>

The problem is described here: http://www.sqlite.org/src/info/9f2eb3abac

The fix is here: http://www.sqlite.org/src/info/c1152bdcbb

A patch release 3.8.0.1 that includes this fix and fixes for two other equally 
obscure corner cases is currently in test and is expected to go out later today.

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


This email and any attachments are only for use by the intended recipient(s) 
and may contain legally privileged, confidential, proprietary or otherwise 
private information. Any unauthorized use, reproduction, dissemination, 
distribution or other disclosure of the contents of this e-mail or its 
attachments is strictly prohibited. If you have received this email in error, 
please notify the sender immediately and delete the original.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] segmentation fault with 3.8.0

2013-08-29 Thread Richard Hipp
On Thu, Aug 29, 2013 at 11:38 AM, Richard Hipp  wrote:

>
>
> A patch release 3.8.0.1 that includes this fix and fixes for two other
> equally obscure corner cases is currently in test and is expected to go out
> later today.
>
>
Complete set of diffs for the proposed patch release:
http://www.sqlite.org/src/vdiff?from=f64cd21e2e23ed7c=c5857808c0707baa=1

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


Re: [sqlite] segmentation fault with 3.8.0

2013-08-29 Thread Richard Hipp
On Thu, Aug 29, 2013 at 11:32 AM, Stephen Chrzanowski
wrote:

> My guess is single quotes instead of double quotes.  Where exactly is the
> seg fault?  Untested but other than the quotes, everything looks fine.
>

The problem is described here: http://www.sqlite.org/src/info/9f2eb3abac

The fix is here: http://www.sqlite.org/src/info/c1152bdcbb

A patch release 3.8.0.1 that includes this fix and fixes for two other
equally obscure corner cases is currently in test and is expected to go out
later today.

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


Re: [sqlite] segmentation fault with 3.8.0

2013-08-29 Thread Stephen Chrzanowski
My guess is single quotes instead of double quotes.  Where exactly is the
seg fault?  Untested but other than the quotes, everything looks fine.



On Thu, Aug 29, 2013 at 4:07 AM, kenichi ishigaki wrote:

> Hi. I've just got a segmentation fault report with SQLite 3.8.0 from
> one of the perl binding users. The following set of SQL statements
> should reporduce the issue.
>
> Regards,
>
> Kenichi Ishigaki
>
>
>
> CREATE TABLE "twokeys" (
> "artist" integer NOT NULL,
> "cd" integer NOT NULL,
> PRIMARY KEY ("artist", "cd")
> );
>
> CREATE TABLE "fourkeys" (
> "foo" integer NOT NULL,
> "bar" integer NOT NULL,
> "hello" integer NOT NULL,
> "goodbye" integer NOT NULL,
> "sensors" character(10) NOT NULL,
> "read_count" int,
> PRIMARY KEY ("foo", "bar", "hello", "goodbye")
> );
>
> CREATE TABLE "fourkeys_to_twokeys" (
> "f_foo" integer NOT NULL,
> "f_bar" integer NOT NULL,
> "f_hello" integer NOT NULL,
> "f_goodbye" integer NOT NULL,
> "t_artist" integer NOT NULL,
> "t_cd" integer NOT NULL,
> "autopilot" character NOT NULL,
> "pilot_sequence" integer,
> PRIMARY KEY ("f_foo", "f_bar", "f_hello", "f_goodbye", "t_artist", "t_cd")
> );
>
> INSERT INTO fourkeys ( bar, foo, goodbye, hello, read_count, sensors)
> VALUES ( 1, 1, 1, 1, 1, 1 );
>
> INSERT INTO twokeys ( artist, cd) VALUES ( 1, 1 );
>
> INSERT INTO fourkeys_to_twokeys ( autopilot, f_bar, f_foo, f_goodbye,
> f_hello, pilot_sequence, t_artist, t_cd) VALUES ( 1, 1, 1, 1, 1, 1, 1,
> 1 );
>
> DELETE FROM fourkeys_to_twokeys WHERE f_bar = 1 AND f_foo = 1 AND
> f_goodbye = 1 AND f_hello = 1 AND t_artist = 1 AND t_cd = 1;
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users