IBM Support

LI73181: INSTANCE CAN CRASH IF XQUERY USES POSITION() OR FN:POSITION() WITHOUT THE CONTEXT ITEM DEFINED

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as fixed if next.

Error description

  • Instance can crash if XQuery uses position() or fn:position()
    without the context item defined.  The signal 11 stack trace
    will look something like the following:
    
    0        ossDumpStackTrace
    1        OSSTrapFile::dump
    2        sqlo_trce
    3        sqloEDUCodeTrapHandler
    4        __h_errno_location
    5        sqlnq_qunqncchild::pp
    6        sqlnq_xp_provide_context_sequence
    7        sqlnq_xq_prefix_expression
    8        sqlnq_encap_doit
    9        sqlnq_fun_res_walk
    10       sqlnq_fun_tres
    11       sqlnq_xq_sem
    12       sqlxp_smactn
    13       sqlxp_parser
    14       sqlxp_main
    ............
    49       sqloRunInstance
    50       DB2main
    51       main
    52       __libc_start_main
    53       sqloWaitChild
    

Local fix

  • Depending on what the desired output of your query was, you can
    restructure your query using one of the following sample
    queries:
    
    Queries are based on this ddl and data:
    
    create table test ( name char(4), xmldoc xml)
    
    insert into test (name, xmldoc) values( 'aaaa',
    '<doc><more>a1</more><more>a2</more><more>a3</more></doc>'),(
    'bbbb',
    '<doc><more>b1</more><more>b2</more><more>b3</more></doc>')
    
    --Option 1--
    select m.name, t.SAY, t.POS from test m, xmltable('$c/doc/more'
    passing m.xmldoc as "c" columns
    "SAY" varchar(10) path '.', "POS" int path './fn:position()') as
    t where 1 = 1
    
    NAME   SAY   POS
    ---------   ------  -----
    aaaa a1 1
    aaaa a2 1
    aaaa a3 1
    bbbb b1 1
    bbbb b2 1
    bbbb b3 1
    
    --Option 2-
    
    --> use rownumber() over() to retrieve the position
    
    SELECT m.name, xt.* FROM test m, TABLE(SELECT x.*, ROWNUMBER()
    OVER () as POS FROM XMLTABLE('$xml/doc/more' passing m.xmldoc as
    "xml"
    columns "SAY" varchar(10) path '.') as x) as xt WHERE 1=1
    
    NAME SAY POS
    ---- ---------- -----------
    aaaa a1 1
    aaaa a2 2
    aaaa a3 3
    bbbb b1 1
    bbbb b2 2
    bbbb b3 3
    
    --Option 3-
    
    -> the following xquery workaround returns the same output as
    Option 2
    
    select m.name, t.SAY, t.POS from test m, xmltable( 'for $i at $j
    in $c/doc/more
    return <result><pos>{$j}</pos><item>{$i}</item></result>'
    passing m.xmldoc as "c" columns "SAY" varchar(10) path './item',
    "POS" int path './pos') as t where 1 = 1
    
    NAME SAY POS
    ---- --- ---
    aaaa a1 1
    aaaa a2 2
    aaaa a3 3
    bbbb b1 1
    bbbb b2 2
    bbbb b3 3
    

Problem summary

  • +
    

Problem conclusion

Temporary fix

Comments

APAR Information

  • APAR number

    LI73181

  • Reported component name

    DB2 UDE ESE LIN

  • Reported component ID

    5765F4104

  • Reported release

    910

  • Status

    CLOSED FIN

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2008-02-26

  • Closed date

    2008-06-23

  • Last modified date

    2008-06-23

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

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

Fix information

Applicable component levels

  • R910 PSY

       UP

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"910","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
15 October 2021