New Line Added to End of Query in EXAplus
Details
| Detail name | Value |
|---|---|
| Changelog Number | 26203 |
| Type | Bug |
| Status | Resolved |
| Affected Versions | |
| Fix Versions | JDBC 25.2.5 |
| Resolution Date | 2025-08-19 |
Description
Previously, SQL queries executed through EXAplus were processed correctly but recorded in audit logs with an unintended newline character. This affected the integrity of query storage and led to inaccuracies in auditing data, such as the SQL_TEXT column.
Example Scenario Before the Fix
Running the following query via EXAplus:
exaplus -c test.db:8563 -u sys -p exasol -sql 'SELECT CURRENT_SESSION;'
The query was stored in the audit logs as:
SELECT CURRENT_SESSION;\n
The inclusion of the newline character (\n) distorted the query text and led to incorrect calculations such as the query length (LENGTH(SQL_TEXT)), which was greater than expected.
This behavior was consistent for both command line execution and file mode query execution.
Example Audit Table Entry Before the Fix
SELECT COMMAND_NAME, COMMAND_CLASS, SQL_TEXT, LENGTH(SQL_TEXT) FROM EXA_DBA_AUDIT_SQL WHERE SESSION_ID = 1837350752058474496;
Output:
COMMAND_NAME COMMAND_CLASS SQL_TEXT LENGTH(SQL_TEXT) SELECT DQL SELECT CURRENT_SESSION;\n 24
Workaround
There is no workaround.
Fix
The issue has been resolved. SQL queries executed via EXAplus are now stored exactly as provided, without additional formatting artifacts such as newline characters. The SQL_TEXT column in audit tables correctly matches the executed query, and query length calculations now reflect the true length of the SQL statement.
Example Audit Table Entry After the Fix
SELECT COMMAND_NAME, COMMAND_CLASS, SQL_TEXT, LENGTH(SQL_TEXT) FROM EXA_DBA_AUDIT_SQL WHERE SESSION_ID = 1837350752058474496;
Output:
COMMAND_NAME COMMAND_CLASS SQL_TEXT LENGTH(SQL_TEXT) SELECT DQL SELECT CURRENT_SESSION; 23
Impact:
- Consistency: Queries are now accurately stored in audit tables without unexpected formatting issues, ensuring reliable logging and auditing.
- Accuracy: The SQL_TEXT column in audit tables matches the original query, and the LENGTH(SQL_TEXT) value reflects the actual query length.
- Applicability: The fix applies to both command line (CLI) execution and file mode execution of SQL queries.
This update improves the reliability of SQL query storage, audit logs, and overall user experience when using EXAplus for query execution.