Informix

With IDS 14.10.FC5 ALTER TABLE of VARCHAR truncates trailing blanks

  • 1.  With IDS 14.10.FC5 ALTER TABLE of VARCHAR truncates trailing blanks

    Posted 9 days ago
    Hello!

    With IDS 14.10.FC5 (no problem with IDS-12.10.FC9IE):

    When changing the size of a VARCHAR column with ALTER TABLE, trailing spaces are removed.

    While CHAR columns are blank-padded, to me trailing blanks in VARCHAR columns are part of the value, even if they are not significant when comparing string values (in Informix SQL).

    Bug or feature? If bug, to be considered as data loss?

    Try this:
    create table tab1 ( pk int not null primary key, name varchar(20) );
    insert into tab1 values (101,'abcdef');
    insert into tab1 values (102,'abc ');
    select name||'<eos>' from tab1 order by pk;
    alter table tab1 modify (name varchar(10));
    select name||'<eos>' from tab1 order by pk;
    drop table tab1;
    Result:

    Database selected.

    Table created.

    1 row(s) inserted.

    1 row(s) inserted.

    (expression)
    abcdef<eos>
    abc <eos>
    2 row(s) retrieved.

    Table altered.

    (expression)
    abcdef<eos>
    abc<eos>
    2 row(s) retrieved.

    Table dropped.

    Database closed.


    ------------------------------
    Sebastien FLAESCH
    ------------------------------