Prepared parameter in LIMIT causes issues

Details

Detail name Value
Changelog Number 29168
Type Bug
Status Resolved
Affected Versions Exasol 7.1.0, Exasol 8.0.0, Exasol 8.29.0, Exasol 2025.1.0, Exasol 2025.2.0
Fix Versions Exasol 2026.1.0, Exasol 2025.2.1, Exasol 2025.1.10
Resolution Date 2026-02-18

Description

Prepared parameters in a LIMIT clause return an incorrect error: “non-negative integer value expected in LIMIT clause”.
Note that SELECT statements are only affected up to version 8.21.0.

Example Exasol 7.1.30 - Exasol 8.20.0:

-- Expected: 1 row
-- Observed: Error: non-negative integer value expected in LIMIT clause
SELECT ? AS c1, 'ABC' AS c2 LIMIT ?;

Example Exasol 8.21.0+:

CREATE OR REPLACE TABLE T(x INT, y INT);

-- Expected: 1 inserted row
-- Observed: Error: non-negative integer value expected in LIMIT clause
INSERT INTO T(x,y) SELECT a, b FROM (SELECT ? as a, 3 as b ORDER BY ? LIMIT ?);

Workaround

The only workaround is not to use a prepared parameter in the LIMIT clause.

select ? as c1, 'ABC' as c2 limit 1;

INSERT INTO T(x,y) SELECT a, b FROM (SELECT ? as a, 3 as b ORDER BY ? LIMIT 1);

Fix

The statements work as intended.