Subject | Re: [firebird-support] What leads to "New size specified for column X must be at least Y character" ? |
---|---|
Author | Helen Borrie |
Post date | 2005-02-06T23:29:06Z |
At 03:46 PM 6/02/2005 +0000, you wrote:
changes is confusing the length of the column in characters with its length
in bytes. A varchar(1000) in unicode_fss is 3000 bytes. There was an old
bug that existed at some point, where the DSQL parser got it wrong with
multi-byte character sets (MBCS) when evaluating length.
Now, I can't tell whether you are using a version of Firebird that has this
bug, or whether the tool's interface is doing some hack on the system
tables to cause this.
To increase the size of the varchar from 300 to 500, you could have worked
around this by creating a new temporary varchar(500) column in unicode_fss,
commit, updated this column with the values from the varchar(300) column,
commit, dropped the original varchar(300) column, commit, created a new
column of the same name, commit, updated this column from the temp column,
commit, then dropped the temp column.
Hoping you took the usual precaution to back up your database before
playing around with metadata, I suggest you go back to the backup and do this.
If you didn't, then take a backup NOW. Proceed to do similar to the above,
with the following difference:
alter table blah
add temp1 varchar(500) character set unicode_fss;
commit;
update blah
set temp1 = substring(original_column from 1 for 500);
commit;
alter table blah
drop original_column;
commit;
alter table blah
add original_column varchar(500) character set unicode_fss;
commit;
update blah
set original_column = temp1;
commit;
Then do a select * from the table to verify that the data is OK.
Then
alter table blah
drop temp1;
commit;
If any of these operations fails, then I suggest that you upgrade Firebird...
./hb
>I have a table with two columns:What's happening here is that the operation that is setting off the size
>-Column A (Char,5,ASCII)
>-Column B (VarChar,1000,UNICODE_FSS)
>
>I tried to changed size of Column B to 500, but Database Workbench says:
> "ISC ERROR CODE:335544351
> ISC ERROR MESSAGE:
> unsuccessful metadata update
> New size specified for column WORD must be at least 3000 characters."
>
>To try things out, I followed and input 3000 and altered the table
>successfully.
>Now I want to change it to 500 again, and it now says:
> "ISC ERROR CODE:335544351
> ISC ERROR MESSAGE:
> unsuccessful metadata update
> New size specified for column WORD must be at least 9000 characters."
>
>What is happening ?
changes is confusing the length of the column in characters with its length
in bytes. A varchar(1000) in unicode_fss is 3000 bytes. There was an old
bug that existed at some point, where the DSQL parser got it wrong with
multi-byte character sets (MBCS) when evaluating length.
Now, I can't tell whether you are using a version of Firebird that has this
bug, or whether the tool's interface is doing some hack on the system
tables to cause this.
To increase the size of the varchar from 300 to 500, you could have worked
around this by creating a new temporary varchar(500) column in unicode_fss,
commit, updated this column with the values from the varchar(300) column,
commit, dropped the original varchar(300) column, commit, created a new
column of the same name, commit, updated this column from the temp column,
commit, then dropped the temp column.
Hoping you took the usual precaution to back up your database before
playing around with metadata, I suggest you go back to the backup and do this.
If you didn't, then take a backup NOW. Proceed to do similar to the above,
with the following difference:
alter table blah
add temp1 varchar(500) character set unicode_fss;
commit;
update blah
set temp1 = substring(original_column from 1 for 500);
commit;
alter table blah
drop original_column;
commit;
alter table blah
add original_column varchar(500) character set unicode_fss;
commit;
update blah
set original_column = temp1;
commit;
Then do a select * from the table to verify that the data is OK.
Then
alter table blah
drop temp1;
commit;
If any of these operations fails, then I suggest that you upgrade Firebird...
./hb