Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 2304 invoked from network); 22 Feb 2007 18:11:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Feb 2007 18:11:33 -0000 Received: (qmail 40476 invoked by uid 500); 22 Feb 2007 18:11:37 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 40455 invoked by uid 500); 22 Feb 2007 18:11:37 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 40433 invoked by uid 99); 22 Feb 2007 18:11:37 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Feb 2007 10:11:37 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [63.82.107.6] (HELO red.amberpoint.com) (63.82.107.6) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Feb 2007 10:11:26 -0800 Received: from [127.0.0.1] (bpendleton-dsk2.edgility.com [10.10.11.13]) by red.amberpoint.com (8.12.11/8.12.11) with ESMTP id l1MIB2Km028988 for ; Thu, 22 Feb 2007 10:11:03 -0800 (PST) Message-ID: <45DDDCB6.8050707@amberpoint.com> Date: Thu, 22 Feb 2007 10:11:02 -0800 From: Bryan Pendleton User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Derby Discussion Subject: Re: problem with ALTER COLUMN DEFAULT on VARCHAR column References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org > 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. Well, I'm not sure what's causing this, but here's what I think is going on, maybe it makes sense: when you alter the default for a column which is automatically generated, the code appears to want to compute the current maximum value for that column, and internally it generates and executes the statement: SELECT MAX(COL_NAME) FROM TABLE_NAME For some reason, this MAX query did not return a numeric value. Perhaps the table is empty, and so the MAX query returned a NULL? Does any of this make sense? Are you altering the default for an automatically generated VARCHAR column? If so, can you try running the SELECT MAX query by hand yourself prior to running the ALTER TABLE statement and see what the SELECT MAX query returns? thanks, bryan