From 3c0b6dc881b4a212eebcedca78aecb808282dcfe Mon Sep 17 00:00:00 2001 From: Robin <7276999+Kaffeetasse@users.noreply.github.com> Date: Wed, 22 Nov 2023 01:31:34 +0100 Subject: [PATCH] Handle npgsql 8 command null value to fix #174 --- src/DistributedLock.Postgres/PostgresAdvisoryLock.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DistributedLock.Postgres/PostgresAdvisoryLock.cs b/src/DistributedLock.Postgres/PostgresAdvisoryLock.cs index 3f6ad6e..9b6d105 100644 --- a/src/DistributedLock.Postgres/PostgresAdvisoryLock.cs +++ b/src/DistributedLock.Postgres/PostgresAdvisoryLock.cs @@ -103,6 +103,7 @@ private PostgresAdvisoryLock(bool isShared) return acquireCommandResult switch { DBNull _ => Cookie, // indicates we called pg_advisory_lock and not pg_try_advisory_lock + null => Cookie, // Npgsql 8 returns null instead of DBNull false => null, true => Cookie, _ => throw new InvalidOperationException($"Unexpected value '{acquireCommandResult}' from acquire command")