incorrect primary key create statement
--------------------------------------

                 Key: DDLUTILS-160
                 URL: https://issues.apache.org/jira/browse/DDLUTILS-160
             Project: DdlUtils
          Issue Type: Bug
          Components: Core - MaxDB/SapDB
         Environment: Windows, SapDB 7.4
            Reporter: Stefan Huber
         Assigned To: Thomas Dudziak


The sql builder creates primary keys with a statement like

          alter table ADDRESS add constraint 'pk_name' primary key (ID)

This statement does not work with SapDB. It uses a statement like

         alter table ADDRESS add primary key (ID)

I worked around this problem by overwriting writeExternalPrimaryKeysCreateStmt 
in SapDbBiulder with

    protected void writeExternalPrimaryKeysCreateStmt(Table table, Column[] 
primaryKeyColumns) throws IOException
    {
        if ((primaryKeyColumns.length > 0) && 
shouldGeneratePrimaryKeys(primaryKeyColumns))
        {
            print("ALTER TABLE ");
            printlnIdentifier(getTableName(table));
            printIndent();
            print("ADD ");
            writePrimaryKeyStmt(table, primaryKeyColumns);
            printEndOfStatement();
        }
    }

This syntax omits the primary key name, but i couldn't find a syntax in the 
SapDB documentation, that supports primary key names.


-- 
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