On 10/1/13 9:02 AM, Frank Rivera wrote:
ALTER TABLE esq.licreq ADD COLUMN u_domain GENERATED ALWAYS AS (UPPER(domain))
Hi Frank,

I have been able to reproduce this problem when the connected user (ROOT in this case) has not created any schema objects of his own. I have logged https://issues.apache.org/jira/browse/DERBY-6361 to track this problem.

Derby only implicitly creates a schema for the default APP user. Derby is supposed to implicitly create a schema for the connected user when the user performs certain operations. But this ALTER TABLE statement isn't one of those operations. The workaround would be to make sure that a schema has been created for the connected user. This can be done explicitly like this...

CREATE SCHEMA root;

Here's a script which shows the problem:

connect 'jdbc:derby:memory:db;create=true;user=esq';

create table licreq( domain varchar( 10 ) );

connect 'jdbc:derby:memory:db;user=root';

-- fails
ALTER TABLE esq.licreq ADD COLUMN u_domain GENERATED ALWAYS AS (UPPER(domain));

create schema root;

-- succeeds
ALTER TABLE esq.licreq ADD COLUMN u_domain GENERATED ALWAYS AS (UPPER(domain));

Hope this helps,
-Rick

Reply via email to