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 148737

Summary: "Create Table" functionality works different that SQL statement
Product: db Reporter: Roman Mostyka <romanmostyka>
Component: CodeAssignee: Jiri Skrivanek <jskrivanek>
Status: RESOLVED WONTFIX    
Severity: blocker CC: sustaining
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 152581    

Description Roman Mostyka 2008-09-30 13:34:50 UTC
1. Open SQL Editor and type following statement:
"create table Test1 ("_test-1 int");".
2. Run it. Table will be created.
3. Rightclick "Tables" node and choose "Create Table...".
4. Type "Test2" for a table name and "_test-1" for column name and click "OK".

Result: Error arises, but such table can be created by SQL statement.
Comment 1 David Vancouvering 2008-10-29 00:40:52 UTC
You need to quote the column name when it uses non-standard characters like "-", just like you do in the SQL.  Please
re-open if you can reproduce when you quote the column name in the create table dialog.
Comment 2 Roman Mostyka 2008-10-29 13:02:02 UTC
With quotes everything works fine. But it isn't obvious that quotes should be used and actually it isn't very convenient
for a customer.
Probably it will be better if this quotes are added by IDE during creation of a table.
Comment 3 David Vancouvering 2008-10-29 18:31:00 UTC
I disagree.  It's up to the user whether they should add quotes or not, I don't think we should be doing this
automatically for users.  We used to do this and it caused no end of confusion, and I actually spend a lot of time
fixing things so this was no longer true.

Just as the user needs to know to quote when typing SQL, they should know they need to quote when using the dialog, IMHO.

If you disagree, please copy Mike and ask for his input.
Comment 4 Roman Mostyka 2008-11-06 18:11:55 UTC
David, I think we have similar thing for MySQL DB creation, why we can't use similar approach here? I think it is
similar problem like we had with MySQL, so I think we also should fix this issue.
Can we use existing mechanism to add quotes to the name of a table?
Comment 5 David Vancouvering 2008-11-06 19:51:01 UTC
After further thought, I agree, we should quote using some heuristics about what needs to be quoted (we have an API that
does this).  I recently fixed this for the MySQL create database, as you noticed.  

The user may still need to quote in some cases.  Thanks for finding this issue and re-opening it.
Comment 6 Roman Mostyka 2008-11-19 14:20:14 UTC
David, can You take a look at this issue? This issue is P3, but it is very annoying and therefore this issue is going to
be included into NetBeans 6.5 Patch 1.
Please fix it till 27 November (this is code freeze date for Patch 1) or update this issue with justification why the
fix isn't possible till this date.
Thanks.
Comment 7 David Vancouvering 2008-11-19 17:27:50 UTC
OK, I'll take a look at it.
Comment 8 pgebauer 2008-11-24 09:30:28 UTC
The issue didn't pass the nomination process by nomination cut-off date. It has been marked as 65fixes2-candidate.
Comment 9 David Vancouvering 2008-12-15 17:30:05 UTC
I thought I fixed this.  Roman, can you still see if you can reproduce?
Comment 10 Roman Mostyka 2008-12-16 17:36:46 UTC
David, this issue is still reproducible. ;)
Comment 11 pgebauer 2009-01-14 09:50:31 UTC
The issue hasn't passed the nomination process for 65patch2 by cut-off date. It has been moved to 65patch3.
Comment 12 Jiri Rechtacek 2009-02-10 15:29:17 UTC
Reassigned to new owner.
Comment 13 pgebauer 2009-04-08 14:07:54 UTC
The status whiteboard "65fixes4-candidate" has been removed.
At this time our proactive patches for the NetBeans 6.5.x IDE have concluded.

If you own a Sun service plan contract for NetBeans, you may wish to contact
Sun Service http://www.sun.com/contact/support.jsp to request a fix via the
product defect escalation process.

For more information on purchasing a Sun service plan contract for NetBeans,
refer to the service plan item "Sun Software Service Plans (S3P) for Developers"
in the Sun Service table found on our NetBeans Support Resources
page http://www.netbeans.org/kb/support.html
Comment 14 Jiri Skrivanek 2009-06-24 15:38:06 UTC
As described in issue 87920, quoting of identifiers is not always desired. There was a fix to not quote newly created
objects (see http://hg.netbeans.org/core-main/rev/55b630eefd2c). Maybe we can use for example
SQLIdentifiers.createQuoter(spec.getMetaData()).quoteIfNeeded(getTableName()); but it is not obvious whether it works
reliably. If yes, than we can also use it everywhere instead of "newobject" logic from #55b630eefd2c.
Because there is only this single request to quote identifiers, we will not implement it and we let users to quote what
they want by hand.