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

Expose a stream of NoticeResponses from Postgres #3621

Open
orf opened this issue Dec 1, 2024 · 0 comments
Open

Expose a stream of NoticeResponses from Postgres #3621

orf opened this issue Dec 1, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@orf
Copy link

orf commented Dec 1, 2024

Is your feature request related to a problem? Please describe.

I'd like to be able to receive a stream of Postgres Notices from a given connection. Ideally this would be done without round-tripping through the tracing/log subsystem.

The specifics of why I need this are somewhat complex, but essentially I'd like to execute SET log_min_messages=debug5, run some queries and collect the log levels that Postgres returns to the client.

Describe the solution you'd like

Some kind of PgListener struct, or stream attached to the connection?

let connection = Connection {...};
let notice_stream = connection.notice_stream()?;
while let Some(notice) = notice_stream.next().await? {
   println!("Got notice: {notice:?}");
}

Describe alternatives you've considered
Unfortunately there are none - I've had to use a lower-level library. Which is really annoying because sqlx is great!

Additional context

From this comment:

BackendMessageFormat::NoticeResponse => {
// do we need this to be more configurable?
// if you are reading this comment and think so, open an issue

@orf orf added the enhancement New feature or request label Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant