Odd PDO/SQLite3 bug

Okay, so consider PHP code like this:

$dbh = new PDO("sqlite::memory:");

create table test(sid integer, str text);
insert into test values(1, 'hello there');

$sth = $dbh->prepare("select * from test where sid = ?");

Run this, and you get the expected result:

[0] => Array
[sid] => 1
[0] => 1
[str] => hello there
[1] => hello there


However, if you remove the integer, or replace it with primary key (but not with integer primary key, mind you!), the query selects 0 rows. Oops. That’s not supposed to happen!

Also, it works with the sqlite2 PDO adapter. Strange, very strange.