Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape string \z meaningless for postgres #694

Open
prakol16 opened this issue Sep 7, 2023 · 0 comments
Open

Escape string \z meaningless for postgres #694

prakol16 opened this issue Sep 7, 2023 · 0 comments

Comments

@prakol16
Copy link

prakol16 commented Sep 7, 2023

Description

The default string escaper uses \z to escape 0x1a ("substitute character"). However, this is not a valid escape sequence in postgresql. The list of valid escape sequences can be found here.

Steps to Reproduce

#[test]
fn test_substitute_char() {
    let ch: SimpleExpr = '\u{1a}'.into();
    let query = Query::select()
        .expr(ch)
        .to_owned();
    // Just one possible escape (other possibilities include e.g. \u001A, etc.)
    assert_eq!(query.to_string(PostgresQueryBuilder), r#"SELECT E'\x1A'"#);
}

Expected Behavior

The output is a valid escape of \x1a.

Actual Behavior

Sea query attempts to escape using \z, but this is not a valid escape character.

Reproduces How Often

Deterministic

Versions

Sea query 0.30.1

Additional Information

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

No branches or pull requests

1 participant