PostgreSQL backup tool with Point-In-Time-Recovery and restore verification
TypeScript backupbackupsdatabasedatabase-backupdevopsdockergolangkubernetesmariadbmongodbmysqlpgpostgrespostgresqls3self-hostedsystem-administrationtoolsweb-ui
FIX (postgresql): Filter TEMP table SELECT checks
Rostislav Dugin699913c25190
diff --git a/backend/internal/features/databases/databases/postgresql/model.go b/backend/internal/features/databases/databases/postgresql/model.goindex bec18f7e..a68bcb54 100644--- a/backend/internal/features/databases/databases/postgresql/model.go+++ b/backend/internal/features/databases/databases/postgresql/model.go@@ -761,12 +761,15 @@ func checkBackupPermissions(// Check SELECT privilege on at least one table (if tables exist)// Use pg_tables from pg_catalog which shows all tables regardless of user privilegesvar tableCount int+if len(includeSchemas) > 0 {// Check only tables in the specified schemaserr = conn.QueryRow(ctx, `SELECT COUNT(*)FROM pg_catalog.pg_tables tWHERE t.schemaname NOT IN ('pg_catalog', 'information_schema')+ AND t.schemaname NOT LIKE 'pg_temp_%'+ AND t.schemaname NOT LIKE 'pg_toast_temp_%'AND t.schemaname = ANY($1::text[])`, includeSchemas).Scan(&tableCount)} else {@@ -775,6 +778,8 @@ func checkBackupPermissions(SELECT COUNT(*)FROM pg_catalog.pg_tables tWHERE t.schemaname NOT IN ('pg_catalog', 'information_schema')+ AND t.schemaname NOT LIKE 'pg_temp_%'+ AND t.schemaname NOT LIKE 'pg_toast_temp_%'`).Scan(&tableCount)}@@ -785,12 +790,15 @@ func checkBackupPermissions(if tableCount > 0 {// Check if user has SELECT on at least one of these tablesvar selectableTableCount int+if len(includeSchemas) > 0 {// Check only tables in the specified schemaserr = conn.QueryRow(ctx, `SELECT COUNT(*)FROM pg_catalog.pg_tables tWHERE t.schemaname NOT IN ('pg_catalog', 'information_schema')+ AND t.schemaname NOT LIKE 'pg_temp_%'+ AND t.schemaname NOT LIKE 'pg_toast_temp_%'AND t.schemaname = ANY($1::text[])AND has_table_privilege(current_user, quote_ident(t.schemaname) || '.' || quote_ident(t.tablename), 'SELECT')`, includeSchemas).Scan(&selectableTableCount)@@ -800,6 +808,8 @@ func checkBackupPermissions(SELECT COUNT(*)FROM pg_catalog.pg_tables tWHERE t.schemaname NOT IN ('pg_catalog', 'information_schema')+ AND t.schemaname NOT LIKE 'pg_temp_%'+ AND t.schemaname NOT LIKE 'pg_toast_temp_%'AND has_table_privilege(current_user, quote_ident(t.schemaname) || '.' || quote_ident(t.tablename), 'SELECT')`).Scan(&selectableTableCount)}