Allow users to register using username in drupal commons throw Integrity constraint violation error
I removed the default value


Sort of but not really - what you've actually done is set a static value of NULL for that field, which will be carried through to the submission regardless of any user input.

Your best bet to avoid these sort of problems would be to implement the field again from scratch:

$form['account']['name'] = array(
  '#type' =&gt; 'textfield',
  '#title' =&gt; t('Username'),
  // ...
);


Note that this won't remove any extra validation that Commons might add, so YMMV and there may be some additional steps to complete your feature.

Just for future reference, to set an initial value for an element that doesn't nuke user input, use #default_value in place of #value.