I'm using SQLite as the back-end database for Drupal.  One of the
Drupal modules I use is called Webform, and Webform has a table that
looks like this:

CREATE TABLE "webform_submissions" (
sid INTEGER NULL DEFAULT '',
nid INTEGER NOT NULL DEFAULT '0',
uid INTEGER NOT NULL DEFAULT '0',
is_draft INTEGER NOT NULL DEFAULT '0',
submitted INTEGER NOT NULL DEFAULT '0',
remote_addr VARCHAR(128) NULL DEFAULT 'NULL',
serial INTEGER NOT NULL CHECK (serial>= 0),
completed INTEGER NOT NULL DEFAULT 0,
modified INTEGER NOT NULL DEFAULT 0,
highest_valid_page INTEGER NOT NULL DEFAULT 0,
 PRIMARY KEY (sid)
);
CREATE UNIQUE INDEX webform_submissions_sid_nid ON webform_submissions
(sid, nid);
CREATE INDEX webform_submissions_nid_uid_sid ON webform_submissions
(nid, uid, sid);
CREATE INDEX webform_submissions_nid_sid ON webform_submissions (nid, sid);

When querying against that table, I'm getting different results
depending on whether I quote numeric values or not:

sqlite> SELECT min(SID) FROM webform_submissions webform_submissions
WHERE (nid = '4') AND (sid > '342');
min(SID) = NULL
Run Time: real 0.001 user 0.000070 sys 0.000000

sqlite> SELECT min(SID) FROM webform_submissions webform_submissions
WHERE (nid = 4) AND (sid > 342);
min(SID) = 343
Run Time: real 0.000 user 0.000062 sys 0.000000

sqlite> SELECT min(SID) FROM webform_submissions webform_submissions
WHERE (nid = '4') AND (sid > 342);
min(SID) = 343
Run Time: real 0.000 user 0.000064 sys 0.000000

So, the equality condition value can be quoted, but the greater-than
condition value cannot.

This seems like a bug to me.

-- 

Tim Gustafson
Technical Lead, Baskin School of Engineering
t...@ucsc.edu
831-459-5354
Baskin Engineering, Room 313A



The most dangerous phrase in the language is, "We've always done it
this way." - Grace Hopper
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to