trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request: Fixes for TRAFODION-1789 & TRAFO...
Date Fri, 12 Feb 2016 19:28:16 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/319#discussion_r52786579
  
    --- Diff: core/sql/sqlcomp/CmpSeabaseDDLschema.cpp ---
    @@ -458,132 +479,159 @@ ComObjectName objName(catName,schName,NAString("dummy"),COM_TABLE_NAME,TRUE);
        {
           *CmpCommon::diags() << DgSqlCode(-CAT_USER_CANNOT_DROP_SMD_SCHEMA)
                               << DgSchemaName(schemaName.getExternalName().data());
    -      return;
    +      goto label_error;
        }
    -   
    -bool isVolatile = (memcmp(schName.data(),"VOLATILE_SCHEMA",strlen("VOLATILE_SCHEMA"))
== 0);
     
    -// Can't drop a schema whose name begins with VOLATILE_SCHEMA unless the 
    -// keyword VOLATILE was specified in the DROP SCHEMA command. 
    +   // Can't drop a schema whose name begins with VOLATILE_SCHEMA unless the 
    +   // keyword VOLATILE was specified in the DROP SCHEMA command. 
        if (isVolatile && !dropSchemaNode->isVolatile())
        {
           *CmpCommon::diags() << DgSqlCode(-CAT_RESERVED_METADATA_SCHEMA_NAME)
                               << DgTableName(schName);
    -      return;
    +      goto label_error;
        }
     
    -// Get a list of all objects in the schema, excluding the schema object itself.
    -char query[4000];
    +   // Get a list of all objects in the schema, excluding the schema object itself.
    +   char query[4000];
     
    +   // select objects in the schema to drop, don't return PRIMARY_KEY_CONSTRAINTS,
    +   // they always get removed when the parent table is dropped.
        str_sprintf(query,"SELECT TRIM(object_name), TRIM(object_type) "
                          "FROM %s.\"%s\".%s "
                          "WHERE catalog_name = '%s' AND schema_name = '%s' AND "
    -                     "object_name <> '"SEABASE_SCHEMA_OBJECTNAME"'" 
    +                     "object_name <> '"SEABASE_SCHEMA_OBJECTNAME"' AND "
    +                     "object_type <> 'PK' "
                          "FOR READ COMMITTED ACCESS",
                    getSystemCatalog(),SEABASE_MD_SCHEMA,SEABASE_OBJECTS,
                    (char*)catName.data(),(char*)schName.data());
       
    -Queue * objectsQueue = NULL;
    -
        cliRC = cliInterface.fetchAllRows(objectsQueue, query, 0, FALSE, FALSE, TRUE);
        if (cliRC < 0)
        {
           cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());
    -      return;
    +      goto label_error;
        }
     
    -   objectsQueue->position();
    -   if ((dropSchemaNode->getDropBehavior() == COM_RESTRICT_DROP_BEHAVIOR) &&
    -       (objectsQueue->numEntries() > 0))
    +   // Check to see if non histogram objects exist in schema, if so, then 
    +   // cascade is required
    +   if (dropSchemaNode->getDropBehavior() == COM_RESTRICT_DROP_BEHAVIOR)
    --- End diff --
    
    So, DROP SCHEMA will now work without CASCADE if SB_HISTOGRAMS exists? Nice change.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message