You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Daniel John Debrunner (JIRA)" <de...@db.apache.org> on 2005/11/23 05:58:37 UTC

[jira] Commented: (DERBY-568) ERROR 42Y07: Schema 'SchemaName' does not exist. But Schema already present in sql sentence

    [ http://issues.apache.org/jira/browse/DERBY-568?page=comments#action_12358333 ] 

Daniel John Debrunner commented on DERBY-568:
---------------------------------------------

The statment failing is as indicated:

-- this will be failed, but this select does not contains errors
-- the same sql run correctly on versions before 10.1.1.0
select * from lcp.transportgrp where transportgrp.name = 'test 2'; 

The exception is:

ij> select * from lcp.transportgrp where transportgrp.name = 'test 2';
ERROR 42Y07: Schema 'ADMIN' does not exist

This seems to be the correct exception, the column name in the where clause is 'transportgrp.name', which is not qualified
by a schema name, so it will resolve to an object in the current schema, which is ADMIN, matching the user name.
This scheme does not exist, Derby's default schema at login matches the username and Derby allows the user to be
in a schema which does not exist.

Thus this seems to be not a bug. Unless some resolution rules automatically map  transportgrp.name to the table lcp.transportgrp
in the from list.

> ERROR 42Y07: Schema 'SchemaName' does not exist. But Schema already present in sql sentence
> -------------------------------------------------------------------------------------------
>
>          Key: DERBY-568
>          URL: http://issues.apache.org/jira/browse/DERBY-568
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.1.1.0
>  Environment: Win XP prof, Java SDK  1.4.2_06, Derby 10.1.1.0
>     Reporter: Igor Azarny

>
> Here files with short remarks to reproduce error
> /****************** create.bat **********************/
> java org.apache.derby.tools.ij derby.sql > create-schema.log
> java org.apache.derby.tools.ij derby-data.sql > init-data.log
> /****************** end create.bat **********************/
> /****************** derby.sql **********************/
> connect 'jdbc:derby:c:\data\test;create=true;databaseName=test';
> create schema lcp;
> CREATE TABLE lcp.transportgrp (
>     transportgrp_id    	INTEGER         GENERATED ALWAYS AS IDENTITY,
>     name	     	VARCHAR(128)    NOT NULL,
>     moddate         	TIMESTAMP       NOT NULL DEFAULT CURRENT_TIMESTAMP,
>     moduser         	VARCHAR(32)     NOT NULL DEFAULT USER,
>     CONSTRAINT transportgrp_pk PRIMARY KEY (transportgrp_id)
> );
> CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.connection.requireAuthentication','true');
> CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.authentication.provider','BUILTIN');
> -- DEFAULT USERS --
> CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.user.ADMIN', 'admin');
> /****************** end derby.sql **********************/
> /****************** derby-data.sql **********************/
> connect 'jdbc:derby:c:\data\lcpdb;user=ADMIN;password=admin';
> insert into lcp.transportgrp(name) values('test 1');
> insert into lcp.transportgrp(name) values('test 2');
> insert into lcp.transportgrp(name) values('test 3');
> -- this sql will be passed
> select * from lcp.transportgrp where lcp.transportgrp.name = 'test 2';
> -- this will be failed, but this select does not contains errors
> -- the same sql run correctly on versions before 10.1.1.0
> select * from lcp.transportgrp where transportgrp.name = 'test 2';
> -- this will be passed also
> select * from lcp.transportgrp a where a.name = 'test 2';
> /****************** end derby-data.sql **********************/

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira