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

Postgres: allow ShouldPrepareCommands to be false to work with npgsql driver Multiplexing #225

Open
samcarton opened this issue Jul 16, 2024 · 1 comment

Comments

@samcarton
Copy link

samcarton commented Jul 16, 2024

Here the code is hard-coding DatabaseConnection.ShouldPrepareCommands to true:

public override bool ShouldPrepareCommands => true;

However we have npgsql's multiplexing enabled on the connection string, which doesn't allow explicit preparation (see related comment in issue). It results in a Explicit preparation not supported with multiplexing NotSupportedException.

  • The current workaround is to remove npgsql-Multiplexing from the connection string when passing it to the PostgresDistributedSynchronizationProvider.
  • If ShouldPrepareCommands could be set to false via options, then I assume we could also opt-out of the DistributedLock-multiplexing and rely on npgsql-Multiplexing instead. Do you see any issues with this?
@madelson
Copy link
Owner

Ideally it would just work, meaning that either we always set should prepare to false for Postgres (how important is it with the current driver?) or we default it based on whether the connection is multiplexing.

That said, I’m curious as to whether distributed locking works with a multiplexed Postgres connection. Is it still able to know which session is holding the lock?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants