Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUGG: Correlated UPDATE and DELETE - SQL Commands
Message
From
23/02/2005 19:22:47
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
BUGG: Correlated UPDATE and DELETE - SQL Commands
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
00989905
Message ID:
00989905
Views:
72
The new SQL Language Improvements are not implemented correctly.

Repro:
CLEAR

CREATE CURSOR joindata (fr i)
INSERT INTO joinData VALUES (1)

CREATE CURSOR table1 (f2 i)
INSERT INTO table1 VALUES (1)
INSERT INTO table1 VALUES (2)
INSERT INTO table1 VALUES (3)
INSERT INTO table1 VALUES (4)

INDEX ON f2 TAG tf2

SET DELETED OFF
SYS(3054,11)

* result is correct
DELETE table1 FROM table1 join joinData ON table1.f2=joinData.fr
? _tally
BROWSE
RECALL ALL IN table1 

* Result is wrong, table1 is not filtered and all records are deleted
DELETE table1 FROM table1 T join joinData ON T.f2=joinData.fr
? _tally
BROWSE
RECALL ALL IN table1 

* expected a compile Error
* the where correlate the two table1, and fix the issue
DELETE table1 FROM table1 T join joinData ON t.f2=joinData.fr where T.f2=table1.f2
? _tally
BROWSE
RECALL ALL IN table1 

* expected a compile Error, the command is ambiguous
DELETE table1 FROM table1 T join joinData ON table1.f2=joinData.fr where T.f2=table1.f2
? _tally
BROWSE
I guess that UPDATE SQL have the same bug.

Fabio
Next
Reply
Map
View

Click here to load this message in the networking platform