SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Alias recognition anomaly

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Alias recognition anomaly
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Alias recognition anomaly Reply with quote
SA has some issues with alias recognition when DELETE is involved. Let's have the following table:

Code:
CREATE TABLE dbo.mytable (a INT PRIMARY KEY, b INT NOT NULL, c INT NULL)


The structure
Code:

<CLAUSE>
FROM dbo.mytable AS m
WHERE|
behaves the way it should for both SELECT or UPDATE clauses. As soon as you press space, a popup appears that includes the alias m for mytable. Pressing 'm' filters the options and pressing '.' after rules out everything else but the aliased table and its columns.


It works with DELETE even if it is syntactically incorrect. I can get the code below by filtering with 'm', '.', 'a':
Quote:

DELETE
FROM dbo.mytable AS m
WHERE m.a = 1
Of course, this code won't compile.


But as soon as it is corrected by adding the alias 'm' to DELETE the alias recognition no longer works properly.
Quote:

DELETE m
FROM dbo.mytable AS m
WHERE|
Pressing space does yield the popup with the alias and pressing 'm' filters but pressing '.' breaks something and the popup vanishes completely. Any idea what may possibly go wrong here?
Fri Jun 29, 2012 6:21 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
Thank you for very detailed and thorough explanation, which is very helpful. Essentially what you have demonstrated here means that in

DELETE [alias]
FROM [table] AS [alias]
WHERE [alias]. [ not working correctly here]

the [alias] in the WHERE clause is not treated as an alias, but rather as a table name likely because that name is found first in the DELETE line and there appears no look-ahead check or that check is not working correctly. Since there is no actual table in the database named [alias], no column popup appears in the WHERE line after "[alias]."

Interesting to note that after the WHERE keyword (WHERE and nothing else after it) pressing space bar causes the correct column popup to appear on the screen with the correct alias referenced at the top of the list. Somehow after the alias + dot combination in the WHERE clause, it doesn't recognize it correctly anymore.

I have submitted a new bug report #SA0019836
Fri Jun 29, 2012 11:23 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
Thank you very much.
Fri Jun 29, 2012 5:01 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.