Fix session crash with view of virtual table using EMITS script

Details

Detail name Value
Changelog Number 20451
Type Bug
Status Resolved
Affected Versions Exasol 8.9.0
Fix Versions Exasol 8.31.0, Exasol 8.29.1
Resolution Date 2024-07-29

Description

The following steps can lead to a session crash:

  1. Create an EMITS script.
  2. Create a virtual schema which uses the EMITS script in the definition of a virtual table.
  3. Create a view selecting from the virtual table.
  4. DESCRIBE the view.

Test case

-- Setup
CREATE SCHEMA IF NOT EXISTS test;

--/
CREATE OR REPLACE PYTHON3 SET SCRIPT test.vs_get (c INT)
EMITS (s CHAR(1) UTF8, t TIMESTAMP) AS
import time
def run(ctx):
  ctx.emit( "a", datetime.datetime.now())
/
;

--/
CREATE OR REPLACE PYTHON3 ADAPTER SCRIPT test.vs_adapter AS
import json
import time
def adapter_call(reqj):
  req = json.loads(reqj)
  req['schemaMetadata'] = {'tables': [ {'name': 'T','columns': [{ 'name': 'C1', 'dataType': {'type': 'CHAR', 'size': 1} }, { 'name': 'C2', 'dataType': {'type': 'TIMESTAMP' } }]}]}
  req['capabilities'] = []
  req['sql'] = "SELECT test.vs_get(1)"
  return json.dumps(req)
/
;

DROP VIRTUAL SCHEMA IF EXISTS test_vs CASCADE;
CREATE VIRTUAL SCHEMA test_vs USING test.vs_adapter;
CREATE OR REPLACE FORCE VIEW test.v AS SELECT * FROM test_vs.t;

-- Expected: Success
-- Observed: Internal server error
DESC test.v;

Workaround

There is no workaround.

Fix

The bug is fixed.