You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by "Rijk van Haaften (JIRA)" <ji...@apache.org> on 2008/06/03 14:52:44 UTC

[jira] Created: (DDLUTILS-208) PostgreSQL: RecreateTableChange loses autoIncrement

PostgreSQL: RecreateTableChange loses autoIncrement
---------------------------------------------------

                 Key: DDLUTILS-208
                 URL: https://issues.apache.org/jira/browse/DDLUTILS-208
             Project: DdlUtils
          Issue Type: Bug
          Components: Core (No specific database), Core - PostgreSql
         Environment: PostgreSQL 8.3.1
            Reporter: Rijk van Haaften
            Assignee: Thomas Dudziak
             Fix For: 1.1


PlatformImplBase.processChange(RecreateTableChange) does not migrate (autoincrement) sequences, but does call SqlBuilder.dropTables. PostgreSqlBuilder.dropTables explicitly drops the sequences:
        for (int idx = 0; idx < columns.length; idx++)
        {
            dropAutoIncrementSequence(table, columns[idx]);
        }
(On the other hand, HsqlDbBuilder does not drop the sequence for instance.)
The sequence is created again, but that causes 'duplicate' errors on the column using the sequence.


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


[jira] Updated: (DDLUTILS-208) Recreating a database does not start the new sequence at the value of the old table

Posted by "Thomas Dudziak (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DDLUTILS-208?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Dudziak updated DDLUTILS-208:
------------------------------------

      Component/s:     (was: Core - PostgreSql)
    Fix Version/s:     (was: 1.1)
                   1.3
          Summary: Recreating a database does not start the new sequence at the value of the old table  (was: PostgreSQL: RecreateTableChange loses autoIncrement)

> Recreating a database does not start the new sequence at the value of the old table
> -----------------------------------------------------------------------------------
>
>                 Key: DDLUTILS-208
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-208
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core (No specific database)
>         Environment: PostgreSQL 8.3.1
>            Reporter: Rijk van Haaften
>            Assignee: Thomas Dudziak
>             Fix For: 1.3
>
>
> PlatformImplBase.processChange(RecreateTableChange) does not migrate (autoincrement) sequences, but does call SqlBuilder.dropTables. PostgreSqlBuilder.dropTables explicitly drops the sequences:
>         for (int idx = 0; idx < columns.length; idx++)
>         {
>             dropAutoIncrementSequence(table, columns[idx]);
>         }
> (On the other hand, HsqlDbBuilder does not drop the sequence for instance.)
> The sequence is created again, but that causes 'duplicate' errors on the column using the sequence.

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


[jira] Commented: (DDLUTILS-208) PostgreSQL: RecreateTableChange loses autoIncrement

Posted by "Rijk van Haaften (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DDLUTILS-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644922#action_12644922 ] 

Rijk van Haaften commented on DDLUTILS-208:
-------------------------------------------

Dropping works fine indeed. My autoincrement column is also primary key. Lets say it contains 5 items: 0,1,2,3,4 Now due to a RecreateTableChange, the sequence and the table are dropped, then newly created and the data of the table is restored. But the sequence is not restored. The new sequence starts at 0 (again). Now creation of a new row fails because primary key 0 already exists. The sequence needs to be restored to 4 (last_value = 4) so creation of new rows goes on from 5 up.


> PostgreSQL: RecreateTableChange loses autoIncrement
> ---------------------------------------------------
>
>                 Key: DDLUTILS-208
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-208
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core (No specific database), Core - PostgreSql
>         Environment: PostgreSQL 8.3.1
>            Reporter: Rijk van Haaften
>            Assignee: Thomas Dudziak
>             Fix For: 1.1
>
>
> PlatformImplBase.processChange(RecreateTableChange) does not migrate (autoincrement) sequences, but does call SqlBuilder.dropTables. PostgreSqlBuilder.dropTables explicitly drops the sequences:
>         for (int idx = 0; idx < columns.length; idx++)
>         {
>             dropAutoIncrementSequence(table, columns[idx]);
>         }
> (On the other hand, HsqlDbBuilder does not drop the sequence for instance.)
> The sequence is created again, but that causes 'duplicate' errors on the column using the sequence.

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


[jira] Commented: (DDLUTILS-208) PostgreSQL: RecreateTableChange loses autoIncrement

Posted by "Thomas Dudziak (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DDLUTILS-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644849#action_12644849 ] 

Thomas Dudziak commented on DDLUTILS-208:
-----------------------------------------

I'm not sure I understand the problem. RecreateTableChange will cause the table to be recreated, and the order of DROP TABLE and DROP SEQUENCE statements makes sure that the table id dropped before the sequence, so how could that cause errors on columns using the sequence ?

> PostgreSQL: RecreateTableChange loses autoIncrement
> ---------------------------------------------------
>
>                 Key: DDLUTILS-208
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-208
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core (No specific database), Core - PostgreSql
>         Environment: PostgreSQL 8.3.1
>            Reporter: Rijk van Haaften
>            Assignee: Thomas Dudziak
>             Fix For: 1.1
>
>
> PlatformImplBase.processChange(RecreateTableChange) does not migrate (autoincrement) sequences, but does call SqlBuilder.dropTables. PostgreSqlBuilder.dropTables explicitly drops the sequences:
>         for (int idx = 0; idx < columns.length; idx++)
>         {
>             dropAutoIncrementSequence(table, columns[idx]);
>         }
> (On the other hand, HsqlDbBuilder does not drop the sequence for instance.)
> The sequence is created again, but that causes 'duplicate' errors on the column using the sequence.

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