[ 
http://issues.apache.org/jira/browse/DERBY-1706?page=comments#action_12435704 ] 
            
Mamta A. Satoor commented on DERBY-1706:
----------------------------------------

Suresh, to answer your question "Why is it necessary to allow users to create a 
non-temporary tables in the "session" schema , when the schema is not created 
explicitly ? "

I think it may have to do with the usability.

Let me take the following generic eg 
connect 'jdbc:derby:c:/dellater/dbmaintest2;create=true' user 'mamta1' as 
mamta1;
select * from sys.syschemas; -- this will not show *mamta1* as one of the 
schemas
create table t1(c11 int); -- the creation of first user-defined object will 
implicitly create the schema *mamta1*
select * from sys.syschemas; -- this will *now* show *mamta1* as one of the 
schemas

I think to avoid the confusion with the usability in case of temporary table 
and non-temporary tables, Derby chose to provide the same behavior for the 2 
table types in "session" schema ie you can create either of the table types in 
"session" schema w/o first having to manually create the "session" schema. This 
behavior also matches the generic eg given above
So, extending the eg above for session schema to show Derby's current behavior
connect 'jdbc:derby:c:/dellater/dbmaintest2;create=true' user 'mamta1' as 
mamta1;
select * from sys.syschemas; -- this will not show *session* schema as one of 
the schemas
set schema session;
select * from sys.syschemas; -- still will not show *session* schema as one of 
the schemas
create table t1(c11 int); -- the creation of first user-defined table will 
implicitly create the schema *session*
select * from sys.syschemas; -- this will *now* show *session* as one of the 
schemas


> NullPointerException occurs when trying to create a table in schema SESSION
> ---------------------------------------------------------------------------
>
>                 Key: DERBY-1706
>                 URL: http://issues.apache.org/jira/browse/DERBY-1706
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.0
>         Environment: Sun JDK 1.4.2
>            Reporter: Yip Ng
>         Assigned To: Mamta A. Satoor
>            Priority: Minor
>             Fix For: 10.2.1.0, 10.3.0.0
>
>         Attachments: DERBY1706NPEwithSessionSchemaV1diff.txt, 
> DERBY1706NPEwithSessionSchemaV2diff.txt, 
> DERBY1706NPEwithSessionSchemaV3diff.txt
>
>
> NPE occurs when attempting to create a table in schema session:
> ij version 10.2
> ij> connect 'jdbc:derby:wombat;create=true' user 'user1';
> WARNING 01J14: SQL authorization is being used without first enabling 
> authentica
> tion.
> ij> set schema session;
> 0 rows inserted/updated/deleted
> ij> create table t1 (i int);
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> derby.log:
> ----------------------------------------------------------------
> 2006-08-16 20:49:02.765 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 
> 10.2.1.0 beta - (430903): instance c013800d-010d-18be-88cf-00000013f010
> on database directory C:\work3\derby\tests\derby-10.2.1.0\lib\wombat  
> Database Class Loader started - derby.database.classpath=''
> 2006-08-16 20:49:17.312 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), 
> (DATABASE = wombat), (DRDAID = null), Cleanup action starting
> 2006-08-16 20:49:17.312 GMT Thread[main,5,main] (XID = 122), (SESSIONID = 0), 
> (DATABASE = wombat), (DRDAID = null), Failed Statement is: create table t1 (i 
> int)
> java.lang.NullPointerException
>       at 
> org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.compile.DDLStatementNode.getSchemaDescriptor(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.compile.DDLStatementNode.getSchemaDescriptor(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.compile.CreateTableNode.referencesSessionSchema(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.GenericPreparedStatement.referencesSessionSchema(Unknown
>  Source)
>       at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>       at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>       at 
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown
>  Source)
>       at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>       at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>       at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
>       at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
>       at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown Source)
>       at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
>       at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
>       at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
>       at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
>       at org.apache.derby.tools.ij.main(Unknown Source)
> Cleanup action completed
> 2006-08-16 20:49:55.312 GMT:
> Shutting down instance c013800d-010d-18be-88cf-00000013f010
> ----------------------------------------------------------------
> sysinfo:
> ------------------ Java Information ------------------
> Java Version:    1.4.2_12
> Java Vendor:     Sun Microsystems Inc.
> Java home:       C:\Program Files\Java\j2re1.4.2_12
> Java classpath:  derby.jar;derbytools.jar;.
> OS name:         Windows XP
> OS architecture: x86
> OS version:      5.1
> Java user name:  Yip
> Java user home:  C:\Documents and Settings\Yip
> Java user dir:   C:\work3\derby\tests\derby-10.2.1.0\lib
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.4
> --------- Derby Information --------
> JRE - JDBC: J2SE 1.4.2 - JDBC 3.0
> [C:\work3\derby\tests\derby-10.2.1.0\lib\derby.jar] 10.2.1.0 beta - (430903)
> [C:\work3\derby\tests\derby-10.2.1.0\lib\derbytools.jar] 10.2.1.0 beta - 
> (430903
> )
> ------------------------------------------------------
> ----------------- Locale Information -----------------
> Current Locale :  [English/United States [en_US]]
> Found support for locale: [de_DE]
>          version: 10.2.1.0 - (430903)
> Found support for locale: [es]
>          version: 10.2.1.0 - (430903)
> Found support for locale: [fr]
>          version: 10.2.1.0 - (430903)
> Found support for locale: [it]
>          version: 10.2.1.0 - (430903)
> Found support for locale: [ja_JP]
>          version: 10.2.1.0 - (430903)
> Found support for locale: [ko_KR]
>          version: 10.2.1.0 - (430903)
> Found support for locale: [pt_BR]
>          version: 10.2.1.0 - (430903)
> Found support for locale: [zh_CN]
>          version: 10.2.1.0 - (430903)
> Found support for locale: [zh_TW]
>          version: 10.2.1.0 - (430903)
> ------------------------------------------------------

-- 
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

        

Reply via email to