From 93538718740ea9222564af3a390a7f63a6a3eca0 Mon Sep 17 00:00:00 2001 From: omer-topal Date: Tue, 17 Sep 2024 16:57:22 +0300 Subject: [PATCH] fix: plan_cache_mode issue for RDS Proxy fix: [BUG] Permify on AWS EKS using an RDS PostgreSQL #1340 --- pkg/database/postgres/postgres.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/database/postgres/postgres.go b/pkg/database/postgres/postgres.go index a128ee510..64f978de3 100644 --- a/pkg/database/postgres/postgres.go +++ b/pkg/database/postgres/postgres.go @@ -180,15 +180,21 @@ func setDefaultQueryExecMode(config *pgx.ConnConfig) { var planCacheModes = map[string]string{ "auto": "auto", "force_custom_plan": "force_custom_plan", + "disable": "disable", } func setPlanCacheMode(config *pgx.ConnConfig) { // Default mode if no specific mode is found in the connection string defaultMode := "auto" - + // Check if a plan cache mode is mentioned in the connection string and set it for key := range planCacheModes { if strings.Contains(config.ConnString(), "plan_cache_mode="+key) { + if key == "disable" { + delete(config.Config.RuntimeParams, "plan_cache_mode") + slog.Info("plan_cache_mode disabled") + return + } config.Config.RuntimeParams["plan_cache_mode"] = planCacheModes[key] slog.Info("setPlanCacheMode", slog.String("mode", key)) return