lpsmith / postgresql-simple

Mid-level client library for accessing PostgreSQL from Haskell
Other
206 stars 71 forks source link

Suppression of NOTICE output? #193

Closed jtdaugherty closed 8 years ago

jtdaugherty commented 8 years ago

I'm seeing a PostgreSQL NOTICE message printed to the terminal where my program is running and I'd like to avoid such output. Example:

Running integration tests.
Tests
    Total population: NOTICE:  truncate cascades to table "community"
OK (14.65s)

All 1 tests passed (14.65s)
Done.

Is this something I can control through postgresql-simple?

lpsmith commented 8 years ago

Not directly, as of yet. However, this functionality has been added to the postgresql-libpq bindings, so you can use Database.PostgreSQL.Simple.Internal.withConnection and Database.PostgreSQL.LibPQ.disableNoticeReporting to achieve what you want.

(Note that the two connection types mentioned in withConnection are indeed different; the first, outer mention refers to a postgresql-simple connection, while the second, inner mention refers to a postgresql-libpq connection.)

jtdaugherty commented 8 years ago

Fantastic - that did what I wanted. Thank you!