Skip to content

minify_sql removes spaces around symbols inside string literals #3

Description

@yeizero

Description
When using sql_minifier version 0.1.5, minify_sql incorrectly removes spaces around symbols inside string literals. This leads to incorrect SQL when the string content contains operators like > or <.

To Reproduce

use sql_minifier::minify_sql;

#[test]
fn test_string_with_symbols() {
    let sql = r#"
        INSERT INTO messages (content) VALUES ('A > B and C < D');
    "#;

    let minified = minify_sql(sql);
    assert_eq!(
        minified,
        "INSERT INTO messages(content) VALUES('A > B and C < D')"
    );
}

Expected behavior
The minified SQL should preserve all spaces and symbols inside string literals:

INSERT INTO messages(content) VALUES('A > B and C < D')

Actual behavior
Currently, minify_sql may remove spaces around > and < inside the string, breaking the SQL logic.

Environment

  • sql_minifier version: 0.1.5
  • Rust version: rustc 1.89.0 (29483883e 2025-08-04) cargo 1.89.0 (c24e10642 2025-06-23)
  • OS: Microsoft Windows 11

Activity

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

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