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 "Niklas Ekman (JIRA)" <ji...@apache.org> on 2006/07/21 22:17:15 UTC

[jira] Created: (DDLUTILS-118) Modifying columns generates wrong SQL statement

Modifying columns generates wrong SQL statement
-----------------------------------------------

                 Key: DDLUTILS-118
                 URL: http://issues.apache.org/jira/browse/DDLUTILS-118
             Project: DdlUtils
          Issue Type: Bug
          Components: Core - PostgreSql
         Environment: PostgreSQL Database Server 8.1, Windows XP SP2, JDBC driver version 8.1-407 JDBC3
            Reporter: Niklas Ekman
         Assigned To: Thomas Dudziak
            Priority: Minor


When changing a column size the following SQL statement is generated:

ALTER TABLE testtable MODIFY test VARCHAR(100)

But according to the PostgreSQL manual it should look like

ALTER TABLE fields ALTER COLUMN test TYPE VARCHAR(111)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (DDLUTILS-118) Modifying columns generates wrong SQL statement

Posted by "Niklas Ekman (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DDLUTILS-118?page=all ]

Niklas Ekman updated DDLUTILS-118:
----------------------------------

    Description: 
When changing a column size the following SQL statement is generated:

ALTER TABLE testtable MODIFY test VARCHAR(100)

But according to the PostgreSQL manual it should look like

ALTER TABLE testtable ALTER COLUMN test TYPE VARCHAR(111)

  was:
When changing a column size the following SQL statement is generated:

ALTER TABLE testtable MODIFY test VARCHAR(100)

But according to the PostgreSQL manual it should look like

ALTER TABLE fields ALTER COLUMN test TYPE VARCHAR(111)


> Modifying columns generates wrong SQL statement
> -----------------------------------------------
>
>                 Key: DDLUTILS-118
>                 URL: http://issues.apache.org/jira/browse/DDLUTILS-118
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core - PostgreSql
>         Environment: PostgreSQL Database Server 8.1, Windows XP SP2, JDBC driver version 8.1-407 JDBC3
>            Reporter: Niklas Ekman
>         Assigned To: Thomas Dudziak
>            Priority: Minor
>
> When changing a column size the following SQL statement is generated:
> ALTER TABLE testtable MODIFY test VARCHAR(100)
> But according to the PostgreSQL manual it should look like
> ALTER TABLE testtable ALTER COLUMN test TYPE VARCHAR(111)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (DDLUTILS-118) Modifying columns generates wrong SQL statement

Posted by "Thomas Dudziak (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DDLUTILS-118?page=all ]

Thomas Dudziak resolved DDLUTILS-118.
-------------------------------------

    Resolution: Fixed

This only appeared when using writeSchemaSqlToFile, which for some reason used the old alteration algorithm. I've removed this old algorithm, and now the correct SQL is generated.

> Modifying columns generates wrong SQL statement
> -----------------------------------------------
>
>                 Key: DDLUTILS-118
>                 URL: http://issues.apache.org/jira/browse/DDLUTILS-118
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core - PostgreSql
>         Environment: PostgreSQL Database Server 8.1, Windows XP SP2, JDBC driver version 8.1-407 JDBC3
>            Reporter: Niklas Ekman
>         Assigned To: Thomas Dudziak
>            Priority: Minor
>
> When changing a column size the following SQL statement is generated:
> ALTER TABLE testtable MODIFY test VARCHAR(100)
> But according to the PostgreSQL manual it should look like
> ALTER TABLE testtable ALTER COLUMN test TYPE VARCHAR(111)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DDLUTILS-118) Modifying columns generates wrong SQL statement

Posted by "Thomas Dudziak (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DDLUTILS-118?page=comments#action_12422775 ] 
            
Thomas Dudziak commented on DDLUTILS-118:
-----------------------------------------

Are you sure that you're using the correct platform and/or current version of DdlUtils ? The PostgreSQL platform does not use a column modification statement at all as it is too limited on the PostgreSQL database. It only uses PostgreSQL specific DDL statements for adding and removing columns:

http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/postgresql/PostgreSqlBuilder.java?view=markup


> Modifying columns generates wrong SQL statement
> -----------------------------------------------
>
>                 Key: DDLUTILS-118
>                 URL: http://issues.apache.org/jira/browse/DDLUTILS-118
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core - PostgreSql
>         Environment: PostgreSQL Database Server 8.1, Windows XP SP2, JDBC driver version 8.1-407 JDBC3
>            Reporter: Niklas Ekman
>         Assigned To: Thomas Dudziak
>            Priority: Minor
>
> When changing a column size the following SQL statement is generated:
> ALTER TABLE testtable MODIFY test VARCHAR(100)
> But according to the PostgreSQL manual it should look like
> ALTER TABLE testtable ALTER COLUMN test TYPE VARCHAR(111)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DDLUTILS-118) Modifying columns generates wrong SQL statement

Posted by "Niklas Ekman (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DDLUTILS-118?page=comments#action_12422923 ] 
            
Niklas Ekman commented on DDLUTILS-118:
---------------------------------------

I'm using the DdlUtils trunk, newly checked out and built with ant. And also, I've checked that it is the org.apache.ddlutils.platform.postgresql.PostgreSqlBuilder that's used when I call PlatformFactory.createNewPlatformInstance(dataSource) (I called platform.getSqlBuilder().getClass().getName() to find out). 

According to the help file for PostgreSQL 8.1 the following statement is used for modifying columns:

ALTER TABLE [ ONLY ] name [ * ]
    action [, ... ]

where action is one of:

   ....
    ALTER [ COLUMN ] column TYPE type [ USING expression ]
   .....

Examples

To change the types of two existing columns in one operation: 

ALTER TABLE distributors
    ALTER COLUMN address TYPE varchar(80),
    ALTER COLUMN name TYPE varchar(100);


This is directly from the help file, I've stripped away stuff that's not important.

> Modifying columns generates wrong SQL statement
> -----------------------------------------------
>
>                 Key: DDLUTILS-118
>                 URL: http://issues.apache.org/jira/browse/DDLUTILS-118
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core - PostgreSql
>         Environment: PostgreSQL Database Server 8.1, Windows XP SP2, JDBC driver version 8.1-407 JDBC3
>            Reporter: Niklas Ekman
>         Assigned To: Thomas Dudziak
>            Priority: Minor
>
> When changing a column size the following SQL statement is generated:
> ALTER TABLE testtable MODIFY test VARCHAR(100)
> But according to the PostgreSQL manual it should look like
> ALTER TABLE testtable ALTER COLUMN test TYPE VARCHAR(111)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira