Executing queries inside Lua scripts or Lua adapters fail

Details

Detail name Value
Changelog Number 18052
Type Bug
Status Resolved
Affected Versions Exasol 7.1.0, Exasol 8.0.0
Fix Versions Exasol 8.33.0, Exasol 8.29.7
Resolution Date 2025-01-29

Description

Executing queries within a Lua script or a Lua virtual schema adapter script can fail with an “Internal Server Error”.
This only happens if the following conditions apply:

  • The databases has more than one node.
  • The Lua script or Lua virtual schema adapter script executes a query.
  • The session id modulo the node count of the cluster is not 0.

Preparation:

CREATE SCHEMA test;
--/
CREATE OR REPLACE LUA ADAPTER SCRIPT test.vs_adapter AS
cjson = require "cjson"
function adapter_call(json_req)
	req = cjson.decode(json_req)
	req.capabilities = {}
	if req.type ~= 'dropVirtualSchema' then
		res = exa.query_no_preprocessing("select 'A' as col from values 123 t(c)")
		req.schemaMetadata = { tables = { {
		type = 'table',
		name = 'TEST',
		columns = {{
		type = 'column',
		name = 'col'..tostring(res[1].COL),
		dataType = { type = "BOOLEAN" }
		} } } } }
end
	return cjson.encode(req)
end
/

Example:

-- This can throw an Internal Server Error with the wrong SessionID.
CREATE VIRTUAL SCHEMA test_vs USING test.vs_adapter;

Workaround

Execute the script in another session.

Fix

The Lua adapter script and Lua virtual schema adapter scripts work without error.