This has been discussed several times on the list. SQLite (and all other 
databases) try very hard to resolve the names you refer to in your query and 
will search all the tables you mention to find *unqualified* references. They 
give up if they do not find exactly one definition.

Try " delete from inflight where inflight.fp in (select flightplans.fp from 
flightplans);

-----Urspr?ngliche Nachricht-----
Von: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] Im Auftrag von Karl 
Lehenbauer
Gesendet: Dienstag, 15. Dezember 2015 20:50
An: sqlite-users at mailinglists.sqlite.org
Betreff: [sqlite] bug when columns are missing in embedded subselect

Consider the following table definitions:


DROP TABLE IF EXISTS flightplans;


CREATE TABLE flightplans (

    id text NOT NULL,

    ident text,

    recvd integer,

    orig text,

    dest text,

    PRIMARY KEY (id)

);



DROP TABLE IF EXISTS inflight;


CREATE TABLE inflight (

    fp text,

ident text,

    alt integer,

    clock integer NOT NULL DEFAULT 0,

    gs integer,

    heading integer,

    lat real,

    lon real,

    reg text,

squawk int,

primary key (fp)

);


It is an error to select a column that doesn?t exist?


sqlite> select fp from flightplans;

Error: no such column: fp

But if I select a column that doesn?t exist within an embedded subquery, it is 
not an error?


sqlite> delete from inflight where fp in (select fp from flightplans);

sqlite>

(In the above example, unless I am mistaken, it should produce more or less the 
same ?no such column? error.)

In my ?real life? version of this stuff where it has a fair number of rows in 
the tables, it appears to be an infinite loop, like with < 100K rows in each 
table I aborted the statement after more than 20 minutes of CPU time.


_______________________________________________
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: hick at scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.


Reply via email to