[ 
https://issues.apache.org/jira/browse/DERBY-6361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-6361:
---------------------------------

    Attachment: derby-6361-01-aa-createDefaultSchema.diff

Attaching derby-6361-01-aa-createDefaultSchema.diff. This patch makes the ALTER 
TABLE statement create the default schema if it doesn't exist. I am running 
tests now.

The error arises because, at execution time, the ALTER TABLE statement cooks up 
an UPDATE statement to run the generation expression on every row of the table 
which has just been given a new generated column. The UPDATE statement fails to 
compile because the schema does not exist. The fix is to create the default 
schema as is done for CREATE TABLE.

Touches the following files:

---------------------

M       
java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java

Create the default schema at execution time if it doesn't exist.

---------------------

M       
java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java

Test case to track this bug.


> Valid statements rejected if Derby has not implicitly created the current 
> user's schema.
> ----------------------------------------------------------------------------------------
>
>                 Key: DERBY-6361
>                 URL: https://issues.apache.org/jira/browse/DERBY-6361
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Rick Hillegas
>         Attachments: derby-6361-01-aa-createDefaultSchema.diff
>
>
> There are many examples of statements failing because Derby has not 
> implicitly created the schema associated with the current user. You don't see 
> this if the schema is the default APP schema. But if the user is anyone other 
> than APP, then various statements can fail. Maybe we should implicitly create 
> a schema even if the user isn't APP. Right now, you get an error like this:
> ERROR 42Y07: Schema 'ROOT' does not exist
> The following script shows an example of this 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));
> connect 'jdbc:derby:memory:db;user=app';
> -- succeeds
> ALTER TABLE esq.licreq ADD COLUMN u_domain GENERATED ALWAYS AS 
> (UPPER(domain));



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to