[PR #168] feat: Add filter option for pg_dump #170

Open
opened 2026-02-26 21:34:50 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/eduardolat/pgbackweb/pull/168
Author: @gautamsi
Created: 1/25/2026
Status: 🔄 Open

Base: developHead: feature/add-filter-option


📝 Commits (10+)

  • a1c38a1 Merge pull request #142 from eduardolat/develop
  • 70e0d9e Merge pull request #156 from eduardolat/develop
  • 20904a1 Initial plan
  • 73b16d6 Initial exploration - understanding backup configuration structure
  • f1ae62d Add filter option for backup configuration with text and guided modes
  • 02e7ecc Format prebuild.mjs with prettier
  • c93e927 Fix code review issues - proper error handling and validation
  • 87226ad Add PostgreSQL version compatibility for filter feature
  • 78eefcd Support include filters in legacy mode (PG 13-16)
  • 4268f7b fix code rabbit comments

📊 Changes

11 files changed (+663 additions, -9 deletions)

View changed files

internal/database/migrations/20251216081402_add_filter_content_to_backups.sql (+9 -0)
📝 internal/integration/postgres/postgres.go (+98 -0)
📝 internal/service/backups/create_backup.sql (+2 -2)
📝 internal/service/backups/update_backup.sql (+2 -1)
📝 internal/service/executions/run_execution.go (+7 -6)
📝 internal/service/executions/run_execution.sql (+1 -0)
📝 internal/view/web/dashboard/backups/common.go (+61 -0)
📝 internal/view/web/dashboard/backups/create_backup.go (+180 -0)
📝 internal/view/web/dashboard/backups/edit_backup.go (+191 -0)
prebuild-simple.mjs (+61 -0)
prebuild.mjs (+51 -0)

📄 Description

I needed a way to exclude table data for several large tables to make use of nightly export for developer use.

decided to add that feature, then I saw --filter option in latest postgres which makes use of a filter file containing multiple include exclude things

This PR adds support for --filter parameter in postgres 17+

Later I updated this to translate the value from this config to legacy --table, --exclude-table etc (only for table schema and table_data) for lower postgres version.

this is how it looks on backup config

Screenshot 2026-01-25 031038

there is another modal for help on this filter option
Screenshot 2026-01-25 031720

There is also a guided mode on this which allows you to select specific options and minimize human errors
image

I have tested that manually in local dev container with postgres 15 and 17

Summary by CodeRabbit

  • New Features

    • Added backup content filtering to include/exclude databases, schemas, tables with support for modern and legacy PostgreSQL.
    • Backup storage now preserves filter definitions.
    • Dual-mode filter editor (Text and Guided) in create/edit backup flows.
  • Documentation

    • New in-app help with filter syntax, examples, and version notes.
  • Chores

    • Added prebuild scripts to consolidate SQL files for build-time generation.

✏️ Tip: You can customize this high-level summary in your review settings.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/eduardolat/pgbackweb/pull/168 **Author:** [@gautamsi](https://github.com/gautamsi) **Created:** 1/25/2026 **Status:** 🔄 Open **Base:** `develop` ← **Head:** `feature/add-filter-option` --- ### 📝 Commits (10+) - [`a1c38a1`](https://github.com/eduardolat/pgbackweb/commit/a1c38a1493d373fff0845714037d03bae2212317) Merge pull request #142 from eduardolat/develop - [`70e0d9e`](https://github.com/eduardolat/pgbackweb/commit/70e0d9e4a6952f7f939b415cedd7897233462f24) Merge pull request #156 from eduardolat/develop - [`20904a1`](https://github.com/eduardolat/pgbackweb/commit/20904a1bca92219bf70b7a600c5150c0b44a8cf2) Initial plan - [`73b16d6`](https://github.com/eduardolat/pgbackweb/commit/73b16d6a4cbc0ed17d2ca8abb9730534c4fea12b) Initial exploration - understanding backup configuration structure - [`f1ae62d`](https://github.com/eduardolat/pgbackweb/commit/f1ae62d8ad601f89150bca2d19c16dd6f8e099ad) Add filter option for backup configuration with text and guided modes - [`02e7ecc`](https://github.com/eduardolat/pgbackweb/commit/02e7eccc32e2a3db9dff418345226d45287fdf49) Format prebuild.mjs with prettier - [`c93e927`](https://github.com/eduardolat/pgbackweb/commit/c93e9275e80334c976ddaff3cdeaa7656baac1f2) Fix code review issues - proper error handling and validation - [`87226ad`](https://github.com/eduardolat/pgbackweb/commit/87226ad60f3cc14e2d4466e68aae55fc5cbe6fb6) Add PostgreSQL version compatibility for filter feature - [`78eefcd`](https://github.com/eduardolat/pgbackweb/commit/78eefcd31b396f3c68b28988deb496cda033b57b) Support include filters in legacy mode (PG 13-16) - [`4268f7b`](https://github.com/eduardolat/pgbackweb/commit/4268f7b19a62cd0f83f05b4b33be0e76de69e094) fix code rabbit comments ### 📊 Changes **11 files changed** (+663 additions, -9 deletions) <details> <summary>View changed files</summary> ➕ `internal/database/migrations/20251216081402_add_filter_content_to_backups.sql` (+9 -0) 📝 `internal/integration/postgres/postgres.go` (+98 -0) 📝 `internal/service/backups/create_backup.sql` (+2 -2) 📝 `internal/service/backups/update_backup.sql` (+2 -1) 📝 `internal/service/executions/run_execution.go` (+7 -6) 📝 `internal/service/executions/run_execution.sql` (+1 -0) 📝 `internal/view/web/dashboard/backups/common.go` (+61 -0) 📝 `internal/view/web/dashboard/backups/create_backup.go` (+180 -0) 📝 `internal/view/web/dashboard/backups/edit_backup.go` (+191 -0) ➕ `prebuild-simple.mjs` (+61 -0) ➕ `prebuild.mjs` (+51 -0) </details> ### 📄 Description I needed a way to exclude table data for several large tables to make use of nightly export for developer use. decided to add that feature, then I saw --filter option in latest postgres which makes use of a filter file containing multiple include exclude things This PR adds support for --filter parameter in postgres 17+ Later I updated this to translate the value from this config to legacy --table, --exclude-table etc (only for table schema and table_data) for lower postgres version. this is how it looks on backup config <img width="720" height="314" alt="Screenshot 2026-01-25 031038" src="https://github.com/user-attachments/assets/9acc4d2f-951c-480b-aa08-5636c6cdd016" /> there is another modal for help on this filter option <img width="539" height="729" alt="Screenshot 2026-01-25 031720" src="https://github.com/user-attachments/assets/d95ecf63-8569-4fe8-8355-83c167af2db4" /> There is also a guided mode on this which allows you to select specific options and minimize human errors <img width="711" height="303" alt="image" src="https://github.com/user-attachments/assets/cbe6253a-f5b7-47b2-94ef-8c0c70b78d8b" /> I have tested that manually in local dev container with postgres 15 and 17 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added backup content filtering to include/exclude databases, schemas, tables with support for modern and legacy PostgreSQL. * Backup storage now preserves filter definitions. * Dual-mode filter editor (Text and Guided) in create/edit backup flows. * **Documentation** * New in-app help with filter syntax, examples, and version notes. * **Chores** * Added prebuild scripts to consolidate SQL files for build-time generation. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pgbackweb#170
No description provided.