This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 137285 - Can't delete row from quoted table
Summary: Can't delete row from quoted table
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Show Data (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: _ ahimanikya
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-16 12:28 UTC by Andrei Badea
Modified: 2008-06-26 15:55 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Badea 2008-06-16 12:28:41 UTC
For a table like

create table `quo+ted` ( `i-d` int not null);

on MySQL I can't delete rows. Moreover, there is no information that the row could not be deleted.
Comment 1 _ ahimanikya 2008-06-16 17:57:09 UTC
I just tested it in my sql, it seems like working for me.

INFO [org.netbeans.modules.db.dataview.output.DataViewOutputPanel]: 
Insert Statement: INSERT INTO `test`.`quo+ted` (`test`.`quo+ted`.`i-d`)  Values(1)

INFO [org.netbeans.modules.db.dataview.output.DataViewOutputPanel]: 
Insert Statement: INSERT INTO `test`.`quo+ted` (`test`.`quo+ted`.`i-d`)  Values(2)

INFO [org.netbeans.modules.db.dataview.output.DataViewOutputPanel]: 
Delete Statement: DELETE FROM `test`.`quo+ted` WHERE `test`.`quo+ted`.`i-d` = '2'

INFO [org.netbeans.modules.db.dataview.output.DataViewOutputPanel]: 
Delete Statement: DELETE FROM `test`.`quo+ted` WHERE `test`.`quo+ted`.`i-d` = '1'


Comment 2 Andrei Badea 2008-06-17 10:53:40 UTC
With the latest version from the wiki:

INFO [org.netbeans.modules.db.dataview.output.DataViewOutputPanel]: Insert Statement: INSERT INTO `test`.`ano+ther`
(`test`.`ano+ther`.`i-d`)  Values(1)
INFO [org.netbeans.modules.db.dataview.output.DataViewOutputPanel]: Insert Statement: INSERT INTO `test`.`ano+ther`
(`test`.`ano+ther`.`i-d`)  Values(2)
INFO [org.netbeans.modules.db.dataview.output.DataViewOutputPanel]: Insert Statement: INSERT INTO `test`.`ano+ther`
(`test`.`ano+ther`.`i-d`)  Values(3)
INFO [org.netbeans.modules.db.dataview.output.DataViewOutputPanel]: Delete Statement: DELETE FROM `test`.`ano+ther`
WHERE i-d = '2'

And in the DataView output tab:

Record successfully inserted.
Record successfully inserted.
Record successfully inserted.
Delete command failed
Error code 1054, SQL state 42S22 -- Unknown column 'i' in 'where clause'
Using SQL:DELETE FROM `test`.`ano+ther` WHERE i-d = '2'
Error code 1054, SQL state 42S22 -- Unknown column 'i' in 'where clause'
Comment 3 _ ahimanikya 2008-06-17 21:17:49 UTC
Not sure whats going on, I just tested and it works fine for me

It executed this successfully (putting the quote appropriately)

DELETE FROM `test`.`quo+ted` WHERE `test`.`quo+ted`.`i-d` = '3'

Make sure you use the latest drop from the wiki.
Comment 4 Andrei Badea 2008-06-18 10:54:34 UTC
Sorry, but:

- I still can reproduce this in version 13.
- You could see from the output I attached that I used the current version (since there were no messages in the output
window in the older version I used when I opened this issue).

So you should try to find out what's going on, not close saying "it works for me".

Upping priority to P1 because row deletion is basic functionality.
Comment 5 _ ahimanikya 2008-06-18 16:21:37 UTC
Created the table using sql editor
create table `quo+ted` ( `i-d` int not null);

Now inserted the row using data view -- the following DMML executed successfully
INSERT INTO `test`.`quo+ted` (`test`.`quo+ted`.`i-d`)  Values(1)

Deleted using using data view -- the following DMML executed successfully
DELETE FROM `test`.`quo+ted` WHERE `test`.`quo+ted`.`i-d` = '1'

Not sure where the problem is. Can someone else test this ?

Use the following drop to test
http://wiki.netbeans.org/attach/DatabaseShowDataModuleReview1/DataViewSuite.zip?version=15
Comment 6 Andrei Badea 2008-06-18 16:43:34 UTC
Ah, that is the difference. I suggest you look at the code which computes the WHERE clause.
Comment 7 _ ahimanikya 2008-06-18 18:05:18 UTC
Yes, I know that there is a difference in qualifier for 'i-d', and I am sure the code does put the qualifier. So, there
is no way I can investigate further unless I can reproduce this. 
Comment 8 Andrei Badea 2008-06-18 22:49:51 UTC
Yes, I understand you are sure. I've had my share of malfunctions where I was sure my code was right, still it was
malfunctioning. Please read the code and try to find a way it could forget to quote the column name.
Comment 9 _ ahimanikya 2008-06-19 14:28:46 UTC
Fixed in the latest drop. Nithya will check in the same to the repository.
http://wiki.netbeans.org/attach/DatabaseShowDataModuleReview1/DataViewSuite.zip?version=16

I was able to reproduce this if I create the table using 

create table `quo+ted` ( `i-d` int primary key );

instead of 

create table `quo+ted` ( `i-d` int not null); as suggested in the bug
Comment 10 _ ahimanikya 2008-06-19 14:29:39 UTC
Adding Nithya to the CC list
Comment 11 Nithya Radhakrishnan 2008-06-19 19:32:01 UTC
The fix for this issue has been checked in into db.dataview module.
Please refer changeset:   83721:70733f3cf54d
Comment 12 Roman Mostyka 2008-06-26 12:54:22 UTC
I'm still able to reproduce this issue with the latest sources from repository (build 080625):
DELETE FROM `test`.`ano+ther` WHERE i-d = '2'; - fails.
DELETE FROM `test`.`ano+ther` WHERE `i-d` = '2'; - passes.
Comment 13 _ ahimanikya 2008-06-26 15:33:49 UTC
I think there is some misunderstanding here,

If you run DELETE FROM `test`.`ano+ther` WHERE i-d = '2'; explicitly in the sqleditor, it should fail

This bug was about Delete feature in data view. Create a table using 

create table `quo+ted` ( `i-d` int primary key );

add few rows and then try to delete a row, it should work. Making as fixed.

Comment 14 Roman Mostyka 2008-06-26 15:55:21 UTC
Verified with build 080626.