IBM Support

IT29945: 10 CHAR VALUE CAN BE INSERTED INTO VARGRAPHIC(5 CODEUNITS32). THIS SHOULD FAIL WITH SQL0433N ERROR.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When a column is defined as VARGRAPHIC with string length unit
    CODEUNITS32,
    it's possible to insert longer-than-allowed values.  For
    example:
    
         create table T (c1 graphic(5 codeunits32),
                               c2 vargraphic(5 codeunits32) );
    
         insert into T values ('abcdefghij','abcdefghij');
         DB20000I  The SQL command completed successfully.  <==
    Should have failed with -433
    
         select c1, hex(c1), length(c1, octets), length(c1,
    codeunits16), length(c1, codeunits32) from T order by c1;
    
    	 C1                   2
    3           4           5
    	 -------------------- ----------------------------------------
    ----------- ----------- -----------
    	 abcde                00610062006300640065
    10           5           5
    
    	   1 record(s) selected.
    
    
         select c2, hex(c2), length(c2, octets), length(c2,
    codeunits16), length(c2, codeunits32) from T order by c2;
    
    	 C2                   2
    3           4           5
    	 -------------------- ----------------------------------------
    ----------- ----------- -----------
    	 abcdefghij           006100620063006400650066006700680069006A
    20          10          10
    
    	   1 record(s) selected.
    
    
      <<< this select shows the problem.
    
    The problem only occurs when all of the following are true:
    - The target column is GRAPHIC or VARGRAPHIC with string units
    CODEUNITS32
    - Inserting a constant value that consists entirely of single
    byte characters
    - The constant length equals twice the target column length (in
    CODEUNITS32)
    
    For a GRAPHIC target column, the value is silently
    truncated to the column size whereas for a VARGRAPHIC column,
    the stored value exceeds the column size.
    

Local fix

  • In the INSERT statement, explicitly cast constant values to
    VARGRAPHIC, e,g.:
    
         insert into T values
    (VARGRAPHIC('abcdefghij'),VARGRAPHIC('abcdefghij'));
         SQL0433N  Value "abcdefghij" is too long.  SQLSTATE=22001
    
    Alternatively, enable the statement concentrator, this replaces
    the constant value with a parameter marker:
    
      db2 update db cfg for <dbname> using stmt_conc literals
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * all                                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to Db2 v11.5.4.0 or higher                           *
    ****************************************************************
    

Problem conclusion

  • Upgrade to Db2 v11.5.4.0 or higher
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT29945

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    B50

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2019-08-08

  • Closed date

    2020-06-30

  • Last modified date

    2020-06-30

  • APAR is sysrouted FROM one or more of the following:

    IT29935

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • RB50 PSN

       UP

[{"Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU053","label":"Cloud \u0026 Data Platform"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.5"}]

Document Information

Modified date:
28 September 2021