Skip to content

Logging SQL #939

Closed
Closed
@andrewthad

Description

@andrewthad

With the scaffolded yesod site, the log output for SQL queries looks like this:

20/Feb/2015:11:18:22 -0500 [Debug#SQL] "SELECT \"draft_sales_order_line\".\"id\", \"draft_sales_order_line\".\"draft_id\", ...

I have truncated the line because it is very long. However, my point is that is it a Haskell-escaped string. This would be great if I was planning on sticking it in GHCi to replay the query, but I never do that. Moreover, I feel pretty confident that almost no one is doing that. I open up psql and copy the queries into that (after having to run a script to unescape C-style strings). It would be nice if the logs just printed the actual query. I'd like to see either one of two things:

  1. Persistent's logging behavior being changed (I think this would be trivial).
  2. The same thing but with optional buy-in.
    The line causing this behavior is right here: https://hackage.haskell.org/package/persistent-2.1.1.4/docs/src/Database-Persist-Sql-Raw.html#rawSql
    In the definition of rawQueryRes where we call show sql. Thanks for any feedback or consideration of this proposal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions