Re: [sqlite] Bug in SQLite 3.8.2

2014-02-12 Thread Richard Hipp
Thanks for the bug report.

Ticket: http://www.sqlite.org/src/info/c34d0557f740c45070
Fixed here: http://www.sqlite.org/src/info/5d01426ddf


On Wed, Feb 12, 2014 at 5:31 AM, Paweł Salawa  wrote:

> Hi,
>
> The bug affects 3.8.2 and 3.8.3.1, I haven't tested other versions.
>
> *Preconditions:*
>
> - 2 databases: A and B.
>
> - database A has table "test":
> CREATE TABLE test (id integer PRIMARY KEY, val text) WITHOUT ROWID
>
> - database B has table "test2":
> CREATE TABLE test2 (EID INTEGER, node1 INTEGER, node2 INTEGER)
>
>
> *To reproduce bug:*
>
> - open database A and attach database B:
> ATTACH 'database_b.db' AS 'attached';
>
> - execute query:
> select test.*, t2.ROWID from attached.test2 t2, test
>
> SQLite says: *no such column: t2.ROWID*
>
> Weird thing is that when you switch test2 and test table positions with
> each other, the same query will work:
> select test.*, t2.ROWID from test, attached.test2 t2
>
> *^^^ this works just fine.*
>
> Problem occurres only if following conditions are met:
> - table in local database is WITHOUT ROWID
> - table in attached database is a regular table with ROWID
> - query selects ROWID from the regular table
> - both tables must be mentioned in the FROM clause
> - the WITHOUT ROWID table must be mentioned as the second one
>
> Regards,
> --
> Paweł Salawa
> pawelsal...@gmail.com
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
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] Bug in SQLite 3.8.2

2014-02-12 Thread Kees Nuyt
On Wed, 12 Feb 2014 11:31:05 +0100, Pawe? Salawa
 wrote:

> - open database A and attach database B:
> ATTACH 'database_b.db' AS 'attached';

This is not the main cause, but that should be:

ATTACH 'database_b.db' AS attached;

(attached should not be a literal but an identifier, just like
table names and column names.)

-- 
Groet, Cordialement, Pozdrawiam, Regards,

Kees Nuyt

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


[sqlite] Bug in SQLite 3.8.2

2014-02-12 Thread Paweł Salawa
Hi,

The bug affects 3.8.2 and 3.8.3.1, I haven't tested other versions.

*Preconditions:*

- 2 databases: A and B.

- database A has table "test":
CREATE TABLE test (id integer PRIMARY KEY, val text) WITHOUT ROWID

- database B has table "test2":
CREATE TABLE test2 (EID INTEGER, node1 INTEGER, node2 INTEGER)


*To reproduce bug:*

- open database A and attach database B:
ATTACH 'database_b.db' AS 'attached';

- execute query:
select test.*, t2.ROWID from attached.test2 t2, test

SQLite says: *no such column: t2.ROWID*

Weird thing is that when you switch test2 and test table positions with
each other, the same query will work:
select test.*, t2.ROWID from test, attached.test2 t2

*^^^ this works just fine.*

Problem occurres only if following conditions are met:
- table in local database is WITHOUT ROWID
- table in attached database is a regular table with ROWID
- query selects ROWID from the regular table
- both tables must be mentioned in the FROM clause
- the WITHOUT ROWID table must be mentioned as the second one

Regards,
-- 
Paweł Salawa
pawelsal...@gmail.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users