IBM Support

A query is failing with "ERROR: 0 : Buffer Overflow"

Troubleshooting


Problem

The replace function fails with error "Buffer Overflow" when the third argument given as '' (null).

Symptom

You run a query using the replace function and leave the third argument empty '' and the query fails with an error:


db(ADMIN)=> select replace('Hello World','World','');
ERROR:  0 : Buffer Overflow

Cause

When the third argument i.e replaceString is given as NULL/Empty, sizer function
returns typmod as ZERO. Hence size of return string becomes ZERO. Hence it is not able to copy anything into return string. Therefore it throws "Buffer Overflow" error.

Environment

Any PureData System for Analytics with the SQL Extension Toolkit version 1.5-P1 or lower

Diagnosing The Problem

Run the 'SELECT regexp_version();' to verify the version of the SQL Extension Toolkit that is installed. If you are running on version prior to 1.5-P2 . You may see the following error when running a query using the replace function with an empty string for the third argument:

db(ADMIN)=> select replace('Hello World','World','');
ERROR:  0 : Buffer Overflow

Wheras in later versions you see the correct result:

db(admin)=> select replace('Hello World','World','');
replace
---------
Hello
(1 row)

Resolving The Problem

Upgrade the SQL Extension Toolkit to version 1.5-P2 or later.

[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Tools","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

More support for:
IBM PureData System

Software version:
1.0.0

Document number:
245613

Modified date:
17 October 2019

UID

swg21679794