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 "Lashan Faliq (JIRA)" <ji...@apache.org> on 2017/09/06 13:26:00 UTC

[jira] [Comment Edited] (DERBY-6395) SYSCS_UTIL.SYSCS_COMPRESS_TABLE message for not found table says: 'ALTER TABLE' cannot be performed

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

Lashan Faliq edited comment on DERBY-6395 at 9/6/17 1:25 PM:
-------------------------------------------------------------

I ran  java org.apache.derbyTesting.functionTests.harness.RunSuite derbyall and the report showed that there were no failures.
Here to fix the bug i first checked if the table existed using the below code.
{code:java}
Connection connection = getDefaultConn();
+		boolean tableExists=false;
+		DatabaseMetaData md = connection.getMetaData();
+		ResultSet rs = md.getTables(null, null, "%", null);
+		while (rs.next()) {
+			if(tablename.equals(rs.getString(3))){
+				tableExists=true;
+			}
+		}
{code}
If it existed i just called existing code if not

{code:java}
else{
+			System.out.println("Compress table cannot be performed on "+tablename+" because it does not exist.");
+		}
     }
{code}

And i have attached the patch for the fix.



was (Author: lashan faliq):
I ran  java org.apache.derbyTesting.functionTests.harness.RunSuite derbyall and the report showed that there were no failures.
Here to fix the bug i first checked if the table existed using the below code.
{code:java}
Connection connection = getDefaultConn();
+		boolean tableExists=false;
+		DatabaseMetaData md = connection.getMetaData();
+		ResultSet rs = md.getTables(null, null, "%", null);
+		while (rs.next()) {
+			if(tablename.equals(rs.getString(3))){
+				tableExists=true;
+			}
+		}
{code}
If it existed i just called existing code if not

{code:java}
else{
+			System.out.println("Compress table cannot be performed on "+tablename+" because it does not exist.");
+		}
     }
{code}



> SYSCS_UTIL.SYSCS_COMPRESS_TABLE message for not found table says: 'ALTER TABLE' cannot be performed 
> ----------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-6395
>                 URL: https://issues.apache.org/jira/browse/DERBY-6395
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.11.1.1
>            Reporter: Kathey Marsden
>            Assignee: Lashan Faliq
>            Priority: Trivial
>         Attachments: derby6395fix.diff
>
>
> For historical reasons SYCSCS_UTIL.SYSCS_COMPRESS_TABLE gives a not very sensible message. The user did not actually execute an ALTER TABLE command.
> ij>  CALL SYSCS_UTIL.SYSCS_COMPRESS_TABLE('APP','NOTTHERE',1);
> ERROR 38000: The exception 'java.sql.SQLException: 'ALTER TABLE' cannot be performed on 'APP.NOTTHERE' because it does n
> ot exist.' was thrown while evaluating an expression.
> ERROR 42Y55: 'ALTER TABLE' cannot be performed on 'APP.NOTTHERE' because it does not exist.
> ij>



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)