Skip to content

VECSL internal error with nested ANY, EXISTS, and RIGHT JOIN subqueries #1464

Description

@chen8908917

Description

Virtuoso fails while compiling inquiry 734 from the generated SQL batch and
returns an internal server error before any result rows are returned. The
optimizer path requires the generated table data and indexes; empty tables or
one-row test data do not reproduce the failure.

Actual error:

VECSL: Internal error, ssl refd before set, please report query to support

Expected: the statement is compiled and returns a normal result set. If the
statement is invalid, Virtuoso should return a specific SQL diagnostic rather
than an internal compiler failure.

The error was originally reproduced on build ffed4676d and remains
reproducible on build 8439c5e52f.

How to repeat

Execute the standalone SQL script through the Virtuoso SQL ODBC endpoint:

07_vecsl_ssl_reference_before_set_reproducer.sql
This file is under the Version part

The script contains the complete cleanup, DDL, 1,000 generated data rows,
indexes, failing query, and final cleanup. It is encoded as UTF-8 without a
byte-order mark (BOM).

The failing query is:

SELECT (t2.c15 - t2.c1) AS q1_col_1,
       CASE WHEN NOT t2.c3 <= 27 THEN 1 ELSE 0 END AS q1_col_2,
       (t2.c15 - 48) AS q1_col_3
FROM t1 AS t1
CROSS JOIN t2 AS t2 ON t1.c6 <> t2.c4
WHERE ((t1.c1 = ANY (
    SELECT DEGREES(t3.c15) AS subq_col_1
    FROM t3 AS t3
    CROSS JOIN t2 AS t4 ON t3.c2 <= t4.c3 AND t3.c12 = 'sample_59'
) AND EXISTS (
    SELECT ATAN2(t5.c3, t5.c4) AS subq_col_1
    FROM t3 AS t5
    RIGHT JOIN t1 AS t6 ON EXISTS (
        SELECT t8.c12 AS subq_col_1
        FROM t1 AS t7
        JOIN t2 AS t8 ON t8.c14 NOT BETWEEN 22 AND 28
        WHERE ((t7.c4 BETWEEN 23 AND 33
                AND t8.c13 NOT BETWEEN '2023-01-01 00:00:00'
                                    AND '2023-12-31 23:59:59')
               OR EXISTS (
                   SELECT t9.c3 AS subq_col_1
                   FROM t1 AS t9
                   WHERE (t9.c4 <> 62
                          OR t9.c1 BETWEEN 22 AND 66
                          OR t9.c5 <> '2023-01-01')
               ))
    )
    WHERE EXISTS (
        SELECT t10.c3 AS subq_col_1
        FROM t3 AS t10
        RIGHT JOIN t2 AS t11 ON t10.c6 >= t11.c14
    )
) AND t2.c6 IS NOT NULL
   AND '.*[0-9]{2}.*' IS NOT NULL
   AND regexp_match('.*[0-9]{2}.*', t2.c6) IS NULL
   AND t2.c1 NOT BETWEEN 30 AND 50)
 OR t1.c5 <> '2023-01-01');

On build 8439c5e52f, statements 1 through 1,027 complete successfully and
statement 1,028 fails with the VECSL error above. There are no other
execution errors.

If a client sends a UTF-8 BOM (U+FEFF) as part of the first SQL statement,
the current build instead stops before setup with:

SQ074: Line 1: syntax error

This SQ074 error is caused by the script encoding and does not execute or
invalidate the VECSL reproducer. Use the attached BOM-free file.

Version

Version 7.2.18-dev.3243-pthreads
Build date: Aug 5 2026
Git commit: 8439c5e

07_vecsl_ssl_reference_before_set_reproducer.sql

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions