[ 
https://issues.apache.org/jira/browse/DERBY-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12726552#action_12726552
 ] 

Mamta A. Satoor commented on DERBY-4295:
----------------------------------------

I looked at this more and DERBY-1062 and the existing tests in 
GrantRevokeDDLTest and actually this was an intentional behavior change. Have 
copied couple comments from DERBY-1062 here in regarding to the table permission
********************
Kathey Marsden added a comment - 13/May/08 12:37 PM 
I didn't take a close look at the patch, but this diff caught my eye. Is there 
a case that used to compress that now throws an error?

"SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('SWIPER', "
             + "'MYTAB', 1, 1, 1)");
- assertUpdateCount(cSt, 0);
+ assertStatementError("38000", cSt);
         cSt.close();

Mamta A. Satoor added a comment - 13/May/08 12:57 PM 
Thanks for taking a look at the patch, Kathey. The test was testing to compress 
a table that is not owned by the user issuing SYSCS_INPLACE_COMPRESS_TABLE. 
After the fix for this jira entry, we correctly throw "38000" just like what we 
do for SYSCS_COMPRESS_TABLE. I hope that answers your question. I have fixed 
the comment in GrantRevokeDDLTest which said that SYSCS_INPLACE_COMPRESS_TABLE 
will not behave correctly until DERBY-1062 is fixed. The comment fix went in as 
revision 655990. 
**************************

So, Lily, what you are experiencing is the expected behavior. I wonder if we 
made any changes to the doc to reflect this change in behavior which went in 
Derby 10.5 I will look into the docs. 

Also, thanks for working on adding the test but we already have coverage for it 
in GrantRevokeDDLTest. Following existing test does the table ownership check
        
        // Try compressing tables not owned.
        
        cSt = samConnection.prepareCall(
            "call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('SWIPER', 'MYTAB', 1)");
        assertStatementError("38000", cSt);
        cSt.close();
        
        cSt = samConnection.prepareCall(
            " call "
            + "SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('SWIPER', "
            + "'MYTAB', 1, 1, 1)");
        assertStatementError("38000", cSt);
        cSt.close();


> SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE cannot be executed after granting 
> permission for execute. 
> --------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4295
>                 URL: https://issues.apache.org/jira/browse/DERBY-4295
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1
>         Environment: Windows Vista
>            Reporter: Lily Wei
>            Priority: Minor
>         Attachments: derby4295.diff
>
>
> When using derby.properties file from mailjdbc tests, call 
> SYSCS_UTIL.SYCS_INPLACE_COMPRESs_TABLE is fine user 'BACKUP' with the 
> following operation. Please see below:
> ij version 10.3
> ij> connect 'jdbc:derby:tpri;user=BACKUP;password=Backup';
> ij> create table a (col1 int, col2 clob);
> 0 rows inserted/updated/deleted
> ij> insert into a values (1, '1');
> 1 row inserted/updated/deleted
> ij> insert into a values (2, '2');
> 1 row inserted/updated/deleted
> ij> grant execute on procedure SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE to 
> BACKUP;
> 0 rows inserted/updated/deleted
> ij version 10.3
> ij> connect 'jdbc:derby:tpri;user=BACKUP;password=Backup';
> ij> call SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('REFRESH','A',1,1,1);
> 0 rows inserted/updated/deleted              <<<====Operation successful=====
>  
> However, on 10.5, the same operation result ERROR 38000
> ij> connect 'jdbc:derby:tpri;create=true;user=REFRESH;password=Refresh';
> ij> create table a (col1 int, col2 clob);
> 0 rows inserted/updated/deleted
> ij> insert into a values (1, '1');
> 1 row inserted/updated/deleted
> ij> insert into a values (1, '2');
> 1 row inserted/updated/deleted
> ij> grant execute on procedure SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE to 
> BACKUP;
> 0 rows inserted/updated/deleted
> ij> exit;
>  
> ij version 10.5
> ij> connect 'jdbc:derby:tpri;user=BACKUP;password=Backup';
> ij> call SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('REFRESH','A',1,1,1);
> ERROR 38000: The exception 'java.sql.SQLException: User 'BACKUP' can not 
> perform
>  the operation in schema 'REFRESH'.' was thrown while evaluating an 
> expression.
> ERROR 42507: User 'BACKUP' can not perform the operation in schema 'REFRESH'. 
>  <<<====Operation result with ERROR 38000
> ERROR 42507: User 'BACKUP' can not perform the operation in schema 
> 'REFRESH'.^M
>         at 
> org.apache.derby.iapi.error.StandardException.newException(StandardEx
> ception.java:303)^M
>         at 
> org.apache.derby.iapi.sql.dictionary.StatementSchemaPermission.check(
> StatementSchemaPermission.java:83)^M
>         at 
> org.apache.derby.impl.sql.conn.GenericAuthorizer.authorize(GenericAut
> horizer.java:186)^M
>         at 
> org.apache.derby.impl.sql.execute.GenericResultSetFactory.getDDLResul
> tSet(GenericResultSetFactory.java:1073)^M
>         at 
> org.apache.derby.impl.sql.execute.ConstantActionActivation.execute(Co
> nstantActionActivation.java:61)^M
>         at 
> org.apache.derby.impl.sql.GenericActivationHolder.execute(GenericActi
> vationHolder.java:352)^M
>         at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Generi
> cPreparedStatement.java:414)^M
>         at 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPre
> paredStatement.java:297)^M
>         at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedState
> ment.java:1235)^M
>         at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Em
> bedPreparedStatement.java:1648)^M
>         at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Embed
> PreparedStatement.java:294)^M
>         at 
> org.apache.derby.catalog.SystemProcedures.SYSCS_INPLACE_COMPRESS_TABL
> E(SystemProcedures.java:1145)^M
>         at 
> org.apache.derby.exe.ac83ba410fx0122x159fx9a84x0000004261f80.g0(Unkno
> wn Source)^M
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)^M
>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)^M
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)^M
>         at java.lang.reflect.Method.invoke(Unknown Source)^M
>         at 
> org.apache.derby.impl.services.reflect.ReflectMethod.invoke(ReflectMe
> thod.java:46)
>         at 
> org.apache.derby.impl.sql.execute.CallStatementResultSet.open(CallSta
> tementResultSet.java:76)^M
>         at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Generi
> cPreparedStatement.java:416)^M
>         at 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPre
> paredStatement.java:297)^M
>         at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedState
> ment.java:1235)^M
>         at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Em
> bedPreparedStatement.java:1648)^M
>         at 
> org.apache.derby.impl.jdbc.EmbedCallableStatement.executeStatement(Em
> bedCallableStatement.java:117)^M
>         at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(EmbedPrepar
> edStatement.java:1303)^M
>         at 
> org.apache.derbyTesting.system.mailjdbc.utils.DbTasks.compressTable(D
> bTasks.java:618)^M
>         at 
> org.apache.derbyTesting.system.mailjdbc.tasks.Backup.DoCompress(Backu
> p.java:79)^M
>         at 
> org.apache.derbyTesting.system.mailjdbc.tasks.Backup.doWork(Backup.ja
> va:68)^M
>         at 
> org.apache.derbyTesting.system.mailjdbc.tasks.Backup.run(Backup.java:
> 46)^M
> Cleanup action completed^M
>        I will add the test to test/langGrantRevokeDDLTest.java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to