From 78d80210a83cf80f1d7b50d349b52f02d04ad10d Mon Sep 17 00:00:00 2001 From: Andrea Debernardi Date: Tue, 30 Jun 2026 15:46:23 +0200 Subject: [PATCH] fix(postgres): cast view name through text before regclass for view definitions pg_get_viewdef was called with $1::regclass directly. Because the parameter is sent through the extended query protocol, the cast was applied to a parameter whose type the server inferred as regclass, which fails for the bound text value. Cast the parameter to text first and then to regclass ($1::text)::regclass so the qualified view name is resolved correctly. --- src-tauri/src/drivers/postgres/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/src/drivers/postgres/mod.rs b/src-tauri/src/drivers/postgres/mod.rs index 009c41a4..830dfd8c 100644 --- a/src-tauri/src/drivers/postgres/mod.rs +++ b/src-tauri/src/drivers/postgres/mod.rs @@ -1006,7 +1006,7 @@ pub async fn get_view_definition( let row = client .query_one( - "SELECT pg_get_viewdef($1::regclass, true) as definition", + "SELECT pg_get_viewdef(($1::text)::regclass, true) as definition", &[&qualified], ) .await