Skip to content

fix: report INTO OUTFILE, DUMPFILE and EXPORT as MODIFIES_DATA - #2932

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
tanjiroK-coder:statementfeatures-into-file-export
Nov 15, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
tanjiroK-coder:statementfeatures-into-file-export

Conversation

@tanjiroK-coder

Copy link
Copy Markdown
Contributor

SELECT ... INTO DUMPFILE passes the mayModifyData() read-only guard

  1. FeatureSelectVisitor.visit(PlainSelect) only handled the INTO @var form of MySqlSelectIntoClause. SELECT '<?php system($_GET[0]); ?>' INTO DUMPFILE '/var/www/s.php' and SELECT a FROM t INTO OUTFILE '/tmp/t.csv' reported RETURNS_RESULT_SET with mayModifyData() == false, so the guard in usage.rst, if (connection.isReadOnly() && features.mayModifyData()), let them through, although MySQL writes a file on the server and returns no rows.
  2. visit(Export) gave Exasol EXPORT t INTO LOCAL CSV FILE '...' (or INTO a table of another database) only READS_DATA, while BigQuery EXPORT DATA and COPY already report MODIFIES_DATA.

The file forms of INTO now report MODIFIES_DATA and drop RETURNS_RESULT_SET as INTO @var already does, and EXPORT reports MODIFIES_DATA. #2868 fixed the Validation side of these clauses; this is the StatementFeatures side.

6 new parameterized StatementFeatureVisitorTest cases fail before and pass after. In ./gradlew check (16607 tests) the only failures are 35 in 8 unrelated classes (Mockito inline mock maker initialisation, AccessDeniedException in ParserKeywordsUtilsTest) that fail the same way on master in my local environment; spotless, checkstyle and PMD pass.

@manticore-projects
manticore-projects merged commit fe2fab8 into JSQLParser:master Nov 15, 2026
8 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants