on 2012 Jan 19 6:08 AM
When in ASA10 database a char column is changed (with alter table), then the field max_inline in table sys.systabcol will be filled. When upgrading this database to ASA12 (12.0.1.3389 or 12.0.1.3519) the size of the char field cannot be reduced anymore: this gives the error Illegal column definition.
Reproduction:
/*Create a database in ASA10 and create a table:*/ create table tSample( tField char(100) ); /*Fill the field with some data*/ insert into tSample(tField) values('A'); /*alter size of the field in ASA10, resulting in sys.systabcol.max_inline=75*/ alter table tSample alter tField char(75); Now convert to ASA12!!! /*After conversion trying to reduce the field size will fail:*/ alter table tSample alter tField char(70);
Secondary problem:
When the size of the field was NOT cahnged in ASA10, the field sys.systabcol.max_inline is still empty on conversion. After the conversion, it is only one time possible to change the field size. After that sys.systabcol.max_inline is filled and any consecutive reduction of the char field size results in the same error Illegal column definition.
Please advice, since we are on the verge of bringing out our new software, only waiting to resolve this problem.
When I tried the repro from your post on the newsgroup, I reloaded to v12 prior to the first alter (as per your instructions there) and could not repro the issue. When I did the reload to v12 after the first alter as described in this forum, I repro'd the issue and I can confirm that my suggested workaround works. Just execute the following two statements to get the alter to work:
alter table tSamplealter tField char( 75 ) inline use default prefix use default;
alter table tSample alter tField char( 70 );
In particular, notice that the first statement does not attempt to change the column width.
This simple workaround should allow you to script your upgrades without waiting for an EBF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What exactly does "it still blocks..." mean?
Do these columns contain data that is longer than the new specified column size? - Cf. the string_rtruncation option.
'it still blocks' means that it is not possible to reduce the size of the field, giving the error Illegal column definition.
On testing i tried a field with char(50) to reduce to char(40). It held one record with '123' only. So, data conversion is not needed.
The case with Sybase is reproduced and is forwarded to the technicians. We will see what the result will be.
I don't know for sure but an according fix might have been made in v12.0.1.3575 - cf. this CR 696638 note:
Using an ALTER TABLE statement to change the length of a string column (char, [long] varchar, [long] binary) that used default INLINE/PREFIX values, would also have explicitly set the INLINE/PREFIX values for that column if there was data in the table. This has been fixed.
Arco had posted the identical question in the NNTP forum sybase.public.sqlanywhere.general, where John Smirnios had indicated that this is a known issue and will be fixed in a forthcoming EBF.
Edit: To cite John's response here:
Use two alters: first 'inline use default' then change the datatype. There is already a bug report in the system to prevent the max_inline value from being set to non-null unnecessarily.
-john.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i've upgraded many db's from ASA 8 to 11 and several to ASA 12.
i would suggest using Sybase Central and unload the old db (schema and data)
do not load into a new db.
create a version 12 db.
open iSQL and open reload.sql.
you may get errors because of system table changes (table not found)
i've ignored the errors and the db works as it does in ASA 8.
i've unloaded and reloaded a 3 gig db in less then an hour.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is impossible to use Sybase Central, because the upgrade must be done with 1000s of customers, done by themselves.
I replied on another forum (currently the wrong wone, because all discussions must be held here...):
With the convert to ASA12 I mean: DbUnload -ar -y -u -dc -er -c "uid=..."
I hope you didn't forget to enter some data in the field in ASA10?
Also, when the size was not changed in ASA10, it should be changed two time in ASA12 to reproduce the error (first time the inline_max was still NULL)
I tried this with a complete new database created in ASA10 with dbInit, created table wich char field, populated the table and changed field size. After DbUnload with ASA12 on resizing teh field I always get the error. So it is strange you do not get this error.
Just to be sure: Are you saying the workaround as stated by John (cf. his comment on your question) does not work in your case?
If it does work (as John expects it), I would be content with such a workaround for the moment - if you have to apply update scripts to thousands of customers, it shouldn't matter whether there are two statements needed instead of one in those scripts... It's a workaround, apparently, and it should be fixed, but that shouldn't prevent you from going on.
Of course, if if does not work in your case, then please disregard my post.
User | Count |
---|---|
67 | |
11 | |
10 | |
10 | |
9 | |
8 | |
6 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.