[sqlite] Type affinity changed by HAVING clause

2010-03-02 Thread WClark
Hi, I think I may have found a bug where affinities change through the HAVING expression. For example, under v3.6.22, if I do... create table t1(a text, b int); insert into t1 values(123, 456); select typeof(a), a from t1 group by a having a

Re: [sqlite] Minor odd behaviour in sql parsing (maybe a bug?)

2010-03-01 Thread WClark
>> The following sql is supposedly valid: >> >> select 1 in (1)'hello'; > > Apparently this gets interpreted as > > select (1 in (1)) as "hello"; > >("as" is optional), under SQLite's long-standing policy of > accepting single and double quotes more or less > interchangeably. Hmm, I'd not have

[sqlite] Minor odd behaviour in sql parsing (maybe a bug?)

2010-03-01 Thread WClark
Hi, I spotted this while looking into something else for Alexey: The following sql is supposedly valid: select 1 in (1)'hello'; where as select * from t where 1 in (1)'hello'; returns "Error: near "'hello'": syntax error" (which I would expect!) This occurs on v3.6.22, but I haven't

Re: [sqlite] The SQLite datatyping problem

2010-03-01 Thread WClark
> Now, it is probable that the core can be patched as you request by > assigning affinity to constants during parsing, but I haven't had an > opportunity to look into it and I would have to check very > thoroughly that it will not brake something else if I do patch it > for you. At this

[sqlite] Antwort: The SQLite datatyping problem

2010-03-01 Thread WClark
Alexey, I can certainly tell you what is causing this behaviour: When sqlite does a comparison, it checks the *column* affinity from both sides. In your example, neither sides come from a column, but are constants. Therefore, sqlite uses the NONE affinity on comparison (I think, but I

Re: [sqlite] Question about protected/unprotected 'value' objects

2010-02-24 Thread WClark
> Igor Tandetnik wrote on 24/02/2010: > > I must admit I have no idea what you are talking about, you lost me > thoroughly. In any case, mutex or no mutex, the pointer returned by > sqlite3_column_value is only valid until you step away from that row > or reset the statement. You can't hold onto

Re: [sqlite] Question about protected/unprotected 'value' objects

2010-02-24 Thread WClark
Igor Tandetnik wrote on 24/02/2010: > Well, too bad. Ha! Nothing's that bad!!! > "Protected" means "a mutex is held while the value is outstanding". > If such a hypothetical API existed, it would mean you could instruct > SQLite to hold a mutex for an indefinite period of time, thus >

[sqlite] Question about protected/unprotected 'value' objects

2010-02-24 Thread WClark
Hi, I understand from reading http://www.sqlite.org/c3ref/value.html that there is a distinction between protected and unprotected value objects, and that some api interfaces, notably sqlite3_value*, require the former and others, notably sqlite3_column*, provide the latter. What I would

[sqlite] Possible oversight in alter table statement?

2010-02-15 Thread WClark
Hi, I've noticed in alter.c, around about line 480 there is a direct reference to updating the sqlite_master table, rather than using the SCHEMA_TABLE macro. I wondered whether this was a simple oversight, or by design? It means the following currently happens... sqlite> pragma

[sqlite] Possible memory-leaks in shell / FTS3

2010-01-22 Thread WClark
Hi, I've spotted a very few places where the use of realloc or sqlite3_realloc *may* constitute memory leaks if the realloc fails. Hope this helps; please ignore if I've misread the code... Line numbers should correlate to version 3.6.22, but I've included the name of the function the line

[sqlite] Minor bug: v3.6.22 not showing up as release in fossil!

2010-01-10 Thread WClark
Hi, not a major one, but... version 3.6.22 has not been tagged as "release" in the fossil repository (e.g. in http://www.sqlite.org/src/timeline?t=release). Cheers Will ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Bug in select from tables with unique constraint?

2009-12-16 Thread WClark
Hello again, I have also checked this with 3.6.17 (which works) and 3.6.18 (which doesn't), so it may be something that slipped in between these two versions. In case it is helpful, I'm running of the release checkouts from the fossil repository. The configure is called with

Re: [sqlite] Gauging interest in patches...

2009-12-16 Thread WClark
> - Message from Alexey Pechnikov on Tue, > 15 Dec 2009 22:14:07 +0300 - > > To: > > General Discussion of SQLite Database > > Subject: > > Re: [sqlite] Gauging interest in patches... > > Hello! > > On Tuesday 15 December 2009

[sqlite] Bug in select from tables with unique constraint?

2009-12-16 Thread WClark
Hi people, I think I may have found a bug in v3.6.21 of Sqlite, but would someone be able to kindly verify my findings for me. If I do the following... CREATE TABLE t1 (c1 TEXT UNIQUE); CREATE TABLE t2 (c2 TEXT UNIQUE); INSERT INTO t1(c1) SELECT "a" UNION ALL SELECT "b"; INSERT INTO t2(c2)

Re: [sqlite] Gauging interest in patches...

2009-12-15 Thread WClark
D. Richard Hipp wrote on 15/12/2009 17:05:31: > (1) Have your patches been fully documented and have you generated > automated test cases that provide 100% MC/DC and branch test > coverage? I'm guessing not and yet those are requirements for new > features in the core. I believe they are

Re: [sqlite] Gauging interest in patches...

2009-12-15 Thread WClark
Alexey Pechnikov wrote on 15/12/2009 15:15:42: >> 3. ENFORCE constraint for table columns, for example: CREATE TABLE t(i >> enforce integer, j enforce text). This optional constraint enforces type >> checking so that an entry must match the column type (i.e. integer, real, >> numeric, text,

[sqlite] Antwort: Re: Gauging interest in patches...

2009-12-15 Thread WClark
John Brooks wrote on 15/12/2009 15:13:05: > What license do you put these under? Sorry, I forgot to say in my last email: I'm happy for these to end up in the public domain like Sqlite -- I don't think realistically I could do otherwise given the blessing-style licence that the main Sqlite

Re: [sqlite] Gauging interest in patches...

2009-12-15 Thread WClark
John Brooks wrote on 15/12/2009 15:13:05: > I love the idea of READONLY and ENFORCE. I would certainly make use of > those in amalgamation form. What license do you put these under? > > You should really publish these all somewhere, there are some great > features. Good work. Thank you. I have

[sqlite] Gauging interest in patches...

2009-12-15 Thread WClark
Hi all, This is a quick email just to gauge interest in a number of patches I've created for Sqlite over the last year or so. What I want to know is whether anyone would like me to post one or more of these patches here? I have thought about posting to http://www.sqlite.org/contrib but since

Re: [sqlite] Views across attached databases

2009-11-30 Thread WClark
Alexey Pechnikov wrote on 30/11/2009 19:58:15: > This feature was disabled becouse can produce inconsistent database schema. > If you want to enable this feature then the patch is simple: > > --- sqlite3-3.6.20.orig/src/attach.c > +++ sqlite3-3.6.20/src/attach.c > @@ -447,10 +447,11 @@ > if(

[sqlite] Views across attached databases

2009-11-30 Thread WClark
Hello, Playing around with attached databases in sqlite 3.6.17, I notice that it is possible to create triggers that operate across attached databases, but not views. So something along the lines of: attach database "other.db" as other; create table other.a(a integer); create table b(a

Re: [sqlite] Set error message within virtual table implementation?

2009-11-23 Thread WClark
> Yes, see the zErrMsg member: > > http://sqlite.org/c3ref/vtab.html Thank you! So simple, and I missed it ;o) Will ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

[sqlite] Set error message within virtual table implementation?

2009-11-22 Thread WClark
Hi, Is it possible / can it be possible to set the error message (as would then be read by a call sqlite3_errmsg) from within a virtual table implementation. For example, inside the xUpdate function when some constraint violation has occurred, to give a more accurate error message than the

[sqlite] Question regarding modified ATTACH command

2009-11-03 Thread WClark
Hello, I have a question regarding a modification I've made to the ATTACH DATABASE command in Sqlite. The attached diff file (set against version 3.6.17) shows the modifications I've made, which I hope can be read quite simply. The modification involves adding an optional "READONLY" keyword;