Roger Binns <rog...@rogerbinns.com> writes:

> On 07/03/12 13:46, Steinar Midtskogen wrote:
>> I think indeed that this is a problem:
>
> I cannot reproduce it using my own virtual tables.  This strongly implies
> that it is something to do with the code for your virtual tables.  Doesn't
> your 'interpolate' module use existing tables?

xCreate()/xConnect() will run through the argument list and do a
PRAGMA table_info(%s) and then a couple of SELECT ... FROM %s.  When
created with itself it loops in the PRAGMA query.  When called with a
second table which points back to it, it seems to pass the PRAGMA, but
it loops in the first SELECT query.

> It is also worth pointing out that table names, column names and column
> types live in separate namespaces.  This works just fine:
>
>   sqlite> create table a(a a);
>   sqlite>

Yes, but the arguments of the virtual tables are names, so "CREATE
VIRTUAL TABLE table USING interpolate(table)" will make
xCreate()/xConnect() fire off the queries PRAGMA table_info(table) and
SELECT * FROM table.

Anyway, I managed to break this loop by requiring the argument to have
an integer primary key, which virtual tables don't have, so it can't
be called recursively either.  I'm not sure if this is a restriction
that I want, though.

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

Reply via email to