[ 
https://issues.apache.org/jira/browse/DERBY-6395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lashan Faliq updated DERBY-6395:
--------------------------------
    Attachment: derby6395fix.diff

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)

Reply via email to