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 "Bryan Pendleton (JIRA)" <de...@db.apache.org> on 2006/09/02 18:03:24 UTC

[jira] Resolved: (DERBY-1724) Executing grant statement within a transaction leads to a NPE later when the db owner attempts to update a table

     [ http://issues.apache.org/jira/browse/DERBY-1724?page=all ]

Bryan Pendleton resolved DERBY-1724.
------------------------------------

    Fix Version/s: 10.3.0.0
                       (was: 10.2.1.0)
       Resolution: Duplicate
         Assignee: Bryan Pendleton

I believe that this bug is definitely a duplicate of DERBY-1583, so I'm marking it as such.

There were some questions as to why it mattered, in this bug, whether the GRANT in the repro script was inside a transaction or not. The reason is that a GRANT is a DDL statement from the point of view of the DataDictionary, and when a DDL statement is in a transaction, it disables the DataDictionary cache for the duration of the transaction. Since cached ColumnDescriptor information could mask the DERBY-1583 bug, disabling the cache makes the bug conditions be exposed.

I placed some additional background information about this in the wiki: http://wiki.apache.org/db-derby/DataDictionaryCaching


> Executing grant statement within a transaction leads to a NPE later when the db owner attempts to update a table
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1724
>                 URL: http://issues.apache.org/jira/browse/DERBY-1724
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.2.1.0
>         Environment: Sun JDK 1.4.2
>            Reporter: Yip Ng
>         Assigned To: Bryan Pendleton
>             Fix For: 10.3.0.0
>
>
> Executing grant within a transaction leads to a NPE later when the db owner attempts to update a table.  i.e.:
> ij version 10.2
> ij> connect 'test;create=true' user 'user1' as user1;
> WARNING 01J14: SQL authorization is being used without first enabling authentication.
> ij> connect 'test;create=true' user 'user2' as user2;
> WARNING 01J01: Database 'test' not created, connection made to existing database instead.
> WARNING 01J14: SQL authorization is being used without first enabling authentication.
> ij(USER2)> connect 'test;create=true' user 'user3' as user3;
> WARNING 01J01: Database 'test' not created, connection made to existing database instead.
> WARNING 01J14: SQL authorization is being used without first enabling authentication.
> ij(USER3)> set connection user1;
> ij(USER1)> create table t1001 (c varchar(1));
> 0 rows inserted/updated/deleted
> ij(USER1)> insert into t1001 values 'a', 'b', 'c';
> 3 rows inserted/updated/deleted
> ij(USER1)> autocommit off;
> ij(USER1)> grant select on t1001 to user3;
> 0 rows inserted/updated/deleted
> ij(USER1)> set connection user2;
> ij(USER2)> create table ttt1 (i int);
> 0 rows inserted/updated/deleted
> ij(USER2)> insert into ttt1 values 1;
> 1 row inserted/updated/deleted
> ij(USER2)> set connection user1;
> ij(USER1)> select * from user2.ttt1;
> I          
> -----------
> 1          
> 1 row selected
> ij(USER1)> insert into user2.ttt1 values 2;
> 1 row inserted/updated/deleted
> ij(USER1)> update user2.ttt1 set i = 888;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> ij(USER1)> commit;
> ij(USER1)> 
> derby.log:
> ----------------------------------------------------------------
> 2006-08-18 09:08:42.234 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.0 beta - (430903): instance c013800d-010d-208a-11fd-000000146bf0
> on database directory C:\work3\derby\tests\derby-10.2.1.0\lib\test  
> Database Class Loader started - derby.database.classpath=''
> 2006-08-18 09:08:43.843 GMT Thread[main,5,main] (XID = 129), (SESSIONID = 0), (DATABASE = test), (DRDAID = null), Cleanup action starting
> 2006-08-18 09:08:43.843 GMT Thread[main,5,main] (XID = 129), (SESSIONID = 0), (DATABASE = test), (DRDAID = null), Failed Statement is: update user2.ttt1 set i = 888
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.compile.CompilerContextImpl.addRequiredColumnPriv(Unknown Source)
> 	at org.apache.derby.impl.sql.compile.ResultColumn.bindResultColumnByName(Unknown Source)
> 	at org.apache.derby.impl.sql.compile.ResultColumnList.bindResultColumnsByName(Unknown Source)
> 	at org.apache.derby.impl.sql.compile.ResultSetNode.bindResultColumns(Unknown Source)
> 	at org.apache.derby.impl.sql.compile.SelectNode.bindResultColumns(Unknown Source)
> 	at org.apache.derby.impl.sql.compile.UpdateNode.bind(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-18 09:08:43.875 GMT:
> Shutting down instance c013800d-010d-208a-11fd-000000146bf0
> ----------------------------------------------------------------
> 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