Return-Path: Delivered-To: apmail-db-ddlutils-dev-archive@www.apache.org Received: (qmail 95944 invoked from network); 13 Jul 2006 07:29:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Jul 2006 07:29:49 -0000 Received: (qmail 88925 invoked by uid 500); 13 Jul 2006 07:29:48 -0000 Delivered-To: apmail-db-ddlutils-dev-archive@db.apache.org Received: (qmail 88894 invoked by uid 500); 13 Jul 2006 07:29:48 -0000 Mailing-List: contact ddlutils-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ddlutils-dev@db.apache.org Delivered-To: mailing list ddlutils-dev@db.apache.org Received: (qmail 88883 invoked by uid 99); 13 Jul 2006 07:29:47 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jul 2006 00:29:47 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jul 2006 00:29:46 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 14A96410508 for ; Thu, 13 Jul 2006 07:27:47 +0000 (GMT) Message-ID: <10035278.1152775667082.JavaMail.jira@brutus> Date: Thu, 13 Jul 2006 07:27:47 +0000 (GMT+00:00) From: "Thomas Dudziak (JIRA)" To: ddlutils-dev@db.apache.org Subject: [jira] Updated: (DDLUTILS-73) SQL syntax bug in PostgreSQL 8.1 for ALTER COLUMN In-Reply-To: <142421629.1140500784275.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DDLUTILS-73?page=all ] Thomas Dudziak updated DDLUTILS-73: ----------------------------------- Component: Core - PostgreSql > SQL syntax bug in PostgreSQL 8.1 for ALTER COLUMN > ------------------------------------------------- > > Key: DDLUTILS-73 > URL: http://issues.apache.org/jira/browse/DDLUTILS-73 > Project: DdlUtils > Type: Bug > Components: Core - PostgreSql > Environment: PostgreSQL 8.1 > Reporter: Vignesh Swaminathan > Assignee: Thomas Dudziak > > The following code has to be added to PostgreSQLBuilder class to make it work for altering columns in PostgreSQL > /** > * Generates the alter statement to add or modify a single column on a table. > * > * @param table The table the index is on > * @param column The column to drop > * @param isNewColumn Whether the column should be added > */ > public void writeColumnAlterStmt(Table table, Column column, boolean isNewColumn) throws IOException > { > writeTableAlterStmt(table); > print(isNewColumn ? "ADD " : "ALTER "); > if(isNewColumn) > writeColumn(table, column); > else > writeAlterColumn(table, column); > printEndOfStatement(); > } > > /** > * Outputs the DDL for the specified column. > * > * @param table The table containing the column > * @param column The column > */ > protected void writeAlterColumn(Table table, Column column) throws IOException > { > //see comments in columnsDiffer about null/"" defaults > printIdentifier(getColumnName(column)); > print(" TYPE "); > print(getSqlType(column)); > if ((column.getDefaultValue() != null) || > (getPlatformInfo().isIdentitySpecUsesDefaultValue() && column.isAutoIncrement())) > { > if (!getPlatformInfo().isSupportingDefaultValuesForLongTypes() && > ((column.getTypeCode() == Types.LONGVARBINARY) || (column.getTypeCode() == Types.LONGVARCHAR))) > { > throw new DynaSqlException("The platform does not support default values for LONGVARCHAR or LONGVARBINARY columns"); > } > print(" DEFAULT "); > writeColumnDefaultValue(table, column); > } > if (column.isRequired()) > { > print(" "); > writeColumnNotNullableStmt(); > } > else if (getPlatformInfo().isRequiringNullAsDefaultValue() && > getPlatformInfo().hasNullDefault(column.getTypeCode())) > { > print(" "); > writeColumnNullableStmt(); > } > if (column.isAutoIncrement() && !getPlatformInfo().isIdentitySpecUsesDefaultValue()) > { > if (!getPlatformInfo().isSupportingNonPKIdentityColumns() && !column.isPrimaryKey()) > { > throw new DynaSqlException("Column "+column.getName()+" in table "+table.getName()+" is auto-incrementing but not a primary key column, which is not supported by the platform"); > } > print(" "); > writeColumnAutoIncrementStmt(table, column); > } > } -- 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