Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 87041 invoked from network); 26 Feb 2007 16:37:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Feb 2007 16:37:31 -0000 Received: (qmail 46369 invoked by uid 500); 26 Feb 2007 16:37:36 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 46316 invoked by uid 500); 26 Feb 2007 16:37:36 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 46251 invoked by uid 99); 26 Feb 2007 16:37:36 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Feb 2007 08:37:36 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Feb 2007 08:37:27 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E6165714045 for ; Mon, 26 Feb 2007 08:37:05 -0800 (PST) Message-ID: <11851616.1172507825940.JavaMail.jira@brutus> Date: Mon, 26 Feb 2007 08:37:05 -0800 (PST) From: "Bryan Pendleton (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-2371) Setting a default value for a VARCHAR column fails when column contains data In-Reply-To: <8581570.1172247245967.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-2371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12475893 ] Bryan Pendleton commented on DERBY-2371: ---------------------------------------- Thanks Saurabh! I intend to commit this patch to the trunk in the next day or so, and then merge the change to 10.2. > Setting a default value for a VARCHAR column fails when column contains data > ---------------------------------------------------------------------------- > > Key: DERBY-2371 > URL: https://issues.apache.org/jira/browse/DERBY-2371 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.2.1.6, 10.2.2.0 > Environment: This probably affects all platforms. > Reporter: Tim Dudgeon > Assigned To: Bryan Pendleton > Attachments: modifyValue.diff > > > I'm seeing a problem updating the default value for a VARCHAR column when the column already contains data. I'm, using: > alter table TABLE_NAME alter column COL_NAME DEFAULT 'new value' > and with some VARCHAR columns I get an error like this: > Invalid character string format for type long.; nested exception is java.sql.SQLException: Invalid character string format for type long. > Caused by: ERROR 22018: Invalid character string format for type long. > at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) > at org.apache.derby.iapi.types.SQLChar.getLong(Unknown Source) > at org.apache.derby.impl.sql.execute.AlterTableConstantAction.getColumnMax(Unknown Source) > at org.apache.derby.impl.sql.execute.AlterTableConstantAction.modifyColumnDefault(Unknown Source) > at org.apache.derby.impl.sql.execute.AlterTableConstantAction.execGuts(Unknown Source) > at org.apache.derby.impl.sql.execute.AlterTableConstantAction.executeConstantAction(Unknown Source) > at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source) > at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) > at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) > This only happens on VARCHAR columns containing data. Columns that are entirely NULL update fine. > This was discussed on users mailing list: > http://www.nabble.com/problem-with-ALTER-COLUMN-DEFAULT-on-VARCHAR-column-tf3274046.html > and the conclusion was that it is related to this statement being run internally as part of the updata process: > SELECT MAX(COL_NAME) FROM TABLE_NAME > As reported in that discussion: > -bash-2.05b$ java org.apache.derby.tools.ij > ij version 10.3 > ij> connect 'jdbc:derby:brydb'; > ij> create table t (a varchar(10)); > 0 rows inserted/updated/deleted > ij> alter table t alter column a default 'my val'; > 0 rows inserted/updated/deleted > ij> insert into t (a) values ('hi'); > 1 row inserted/updated/deleted > ij> alter table t alter column a default 'another val'; > ERROR 22018: Invalid character string format for type long. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.