Exception removing expired grants: Cannot write DateTime with Kind=Unspecified to PostgreSQL type 'timestamp with time zone' #88
Replies: 7 comments
-
|
Was this introduced after you upgraded to IdentityServer 7.1.0? If so, from which version? |
Beta Was this translation helpful? Give feedback.
-
|
We migrated from Identity 4.1.2 |
Beta Was this translation helpful? Give feedback.
-
|
There was an important change regarding DateTime in the Entity Framework provider for PostgreSQL. And somehow the delete query that is being generated doesn't take that into account. |
Beta Was this translation helpful? Give feedback.
-
|
We use Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4 long ago before migrated into Duende and all queries were fine until that |
Beta Was this translation helpful? Give feedback.
-
|
Any plans to fix a delete query generation bug ? |
Beta Was this translation helpful? Give feedback.
-
|
In 2023 the LINQ queries that do the deletes were changed to use Other than the hint above you can also create your own version of the class and register it in DI using |
Beta Was this translation helpful? Give feedback.
-
|
Do you have integration tests for PostgreSQL compatibility that cover TokenCleanupService? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
IdentityServer version
7.1.0
.NET version
net8.0
Description
Hi!
It seems that the TokenCleanup job failed for PostgreSQL
[14:00:44 ERR] Exception removing expired grants: Cannot write DateTime with Kind=Unspecified to PostgreSQL type 'timestamp with time zone', only UTC is supported. Note that it's not possible to mix DateTimes with different Kinds in an array, range, or multirange. (Parameter 'value')
[14:00:44 ERR] Failed executing DbCommand (3ms) [Parameters=[@__First_Expiration_0='?' (DbType = DateTime), @__Last_Expiration_1='?' (DbType = DateTime), @__foundIds_2='?' (DbType = Object)], CommandType='Text', CommandTimeout='300']
DELETE FROM "PersistedGrants" AS p
WHERE p."Id" IN (
SELECT p0."Id"
FROM "PersistedGrants" AS p0
WHERE p0."Expiration" < now() AND p0."Expiration" >= @__First_Expiration_0 AND p0."Expiration" <= @__Last_Expiration_1 AND p0."Id" = ANY (@__foundIds_2)
We have:
options.EnableTokenCleanup = true;
Reproduction steps
No response
Expected behavior
No response
Logs
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions