[MDEV-8943] Syntax check for SQL files or SQL queries Created: 2015-10-14  Updated: 2022-02-21

Status: Open
Project: MariaDB Server
Component/s: Scripts & Clients
Fix Version/s: None

Type: Task Priority: Minor
Reporter: BitSmid Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-4680 PARSER - new sql function Open
relates to MDEV-26634 Feature request: add STATEMENT_DIGEST... Closed

 Description   

(I chose an issue type "epic", but this is a feature request)

It would be nice if it were possible to check the syntax of a file, for example as part of a pre-commit hook in a version control system.

I tried to do something like that by abusing the --one-database option of the command-line client:

mysql -u automatic -o mysql < developmentrevival.sql

(Where the .sql file starts with a USE statement that mentions another database than "mysql")

In the query log, I see only the (harmless) SET statements in that file, so this workaround does not influence the wrong database, but alas it does not fail on syntax errors either.

It would be nice if there were a --lint or --dry-run option to do a syntax check.


Generated at Thu Feb 08 07:30:57 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.