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 168166 - No size for VARCHAR whan adding column results in syntax error
Summary: No size for VARCHAR whan adding column results in syntax error
Status: RESOLVED DUPLICATE of bug 150546
Alias: None
Product: db
Classification: Unclassified
Component: Derby (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-06 09:31 UTC by prodoc
Modified: 2009-07-07 09:23 UTC (History)
0 users

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 prodoc 2009-07-06 09:31:26 UTC
This issue is in NB 6.5.1 as well.

A syntax error will occur when adding a new VARCHAR column to a table and no size is provided in the 'Add Column' 
dialog.

E.g. The generated query 'alter table "FOO"."BAR" add FUBAR VARCHAR' results in error 'Syntax error: 
Encountered "<EOF>" at line 1, column 46'.

This happens because no size was provided and Derby/Java DB somehow requires a size to be provided, no default size is 
used. The way I see it is that there are two solutions:

1. Default to a value if no size is provided.
2. Force the user to supply a size.

In case of option 1 the max allowed size could be used where the generated 'VARCHAR' in the query above becomes 'VARCHAR
(32672)'. Pro: no need to supply the size; con: the user might not expect the default chosen size.

In case of option 2 the user isn't allowed to continue to execute the query if no size is provided. Con: the user is 
forced to supply a size; Pro: the user knows what the size will become.

I would slightly prefer option 1. At least both options prevent the user from being presented with a useless error.
Comment 1 Jiri Skrivanek 2009-07-07 09:23:29 UTC
Fixed in 6.8 using option 2.

*** This issue has been marked as a duplicate of 150546 ***