8000 Modifies whitespace within sql strings · Issue #16 · alekseyl/niceql · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Modifies whitespace within sql strings #16
Closed
@eki

Description

@eki

Newlines and extra whitespace are collapsed into single spaces within sql string literals. When running INSERT or UPDATE statements through Niceql - as with the pg_adapter_with_nicesql option - can lead to data corruption.

Example:

[2] pry(main)> Niceql::Prettifier.prettify_sql("select 'foo\nbar  baz'")
=> "select \e[0;36;49m'foo bar baz'\e[0m"

I think the bug is likely here: https://github.com/alekseyl/niceql/blob/master/lib/niceql.rb#L129

I apologize that I don't have time to contribute a bug fix PR.

Without a fix, I don't think pg_adapter_with_nicesql can be used safely even in development.

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

      0