db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John H. Embretsen" <John.Embret...@Sun.COM>
Subject Re: feature or bug?
Date Thu, 29 Nov 2007 18:40:33 GMT
Daniel John Debrunner wrote:
> John Embretsen wrote:
>> If you connect as a new user (foo), and don't explicitly create the 
>> schema
>> (foo), and don't create any database objects (such as tables), you 
>> will see the
>> error. As Derby is probably first looking for the correct table t1 in the
>> default schema of user foo, which is FOO, the error is thrown. 
> I think Rick's e-mail shows that this is not the case, the view is 
> correctly looking for the table in schema the view was compiled against.

Hmm, then why does it try to access the current schema (which may not
exist)? I haven't looked at the code, but my initial guess was that
Derby first looks for this table in the current schema. If the table is
not found there, it moves on to the schema in which the view itself is

Which schema is the view compiled against in the following ij script?

connect 'jdbc:derby:db;create=true';
-- Connected as user APP (default)
create table mytable(a int);
insert into mytable values (99);
create view myview as select * from mytable;
-- Connect as user Bob, who is new to this database
connect 'jdbc:derby:db;user=Bob';
-- If we do this first, the next select statement won't fail:
--create table bobtable(b int);
-- This fails if the schema BOB does not exist:
select * from APP.myview;

If it's compiled against APP, why is Derby trying to access the schema
BOB when selecting from the view?

>> Does it make sense to do something about this, for example creating 
>> the schema
>> implicitly upon the first connection if it does not already exist?
> Since in a number of cases Derby has to deal with the situation anyway 
> (read-only database or connection at least) then it might be better just 
> to fix the bug(s).

Maybe... I'm worried that some of the related situations users run into
may not be considered bugs per se, just some annoying quirks of Derby.


View raw message