sqlines
sqlines copied to clipboard
Informix to PostgreSQL: FUNCTION RETURNING unhandled
This valid Informix function does not convert correctly to PostgreSQL:
CREATE FUNCTION test_returning()
RETURNING VARCHAR(3), VARCHAR(3) ;
RETURN '0','1';
END FUNCTION
The output shows some memory issue too, as it has mungled text:
CREATE OR REPLACE FUNCTION test_returning()
RETURNING VARCHAR(3), VARCHAR(3) ; AS $$
BEGIN
RETURN '0','1';
END;
$$ LANGUAGE plpgsql;
AGE plpgsql;
GE plpgsql;
END CREATE FUNCTION;
LANGUAGE plpgsql;
Code to convert RETURNING to OUT parameter do exist, but it is evidently not triggered: https://github.com/dmtolpeko/sqlines/blob/da5ea50a26cfb0f0c627ee58fa0cfdd5a5275be7/sqlparser/statements.cpp#L9038-L9040
The InformixConvertReturning function is called, as debugging statements show:
XXX ParseInformixReturns enter, returns are 0x558871e2e230
XXX ParseInformixReturns found return datatype VARCHAR
XXX ParseInformixReturns found return datatype VARCHAR
But for some reason those parsed return values are not used/converted
Work in progress fix for this issue is in https://github.com/renesugar/sqlines/pull/3