-
Notifications
You must be signed in to change notification settings - Fork 138
Migrate to GitHub Actions with PostgreSQL 13-18 testing and minimal privilege support #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to GitHub Actions with PostgreSQL 13-18 testing and minimal privilege support #67
Conversation
… beta Co-authored-by: nik <[email protected]>
Co-authored-by: nik <[email protected]>
Co-authored-by: nik <[email protected]>
Co-authored-by: nik <[email protected]>
…ation Co-authored-by: nik <[email protected]>
- Update test matrix to include PostgreSQL 13-17 (supported versions) - Add beta testing for PostgreSQL 18-beta and 19-beta - Remove CircleCI configuration after migrating all functionality - All regression tests preserved from CircleCI implementation
- Replace docker restart with proper pg_ctl stop/start for reliability - Add comprehensive pg_hba.conf configuration (host + local trust) - Add --no-psqlrc flag to prevent psqlrc interference - Improve timing and synchronization with sleep buffer - Add better error handling with || true for stop command - Apply consistent approach to both regular and beta tests
- Add PostgreSQL official APT repository to support all versions - Install postgresql-client-common and postgresql-client packages - This resolves 'Unable to locate package postgresql-client-17' error - Applied to both main test and beta test jobs
- Use postgresql-client-14 from Ubuntu repositories (stable and available) - Remove complex APT repository setup that was causing failures - PostgreSQL client 14 is compatible with all server versions (13-17 + beta) - Add psql --version verification step - Applied to both main test and beta test jobs
…sions - Simplify PostgreSQL client installation to use default package - Remove non-existent PostgreSQL beta versions (18-beta, 19-beta) - Add CHANGELOG.md to track project changes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Use --user postgres flag for docker exec when running pg_ctl commands - This resolves the "pg_ctl: cannot be run as root" error 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Use POSTGRES_HOST_AUTH_METHOD=trust for authentication - Configure shared_preload_libraries via docker options - Remove complex container manipulation steps - Simplify psql commands without PGPASSWORD 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove invalid -c flag from Docker options - Use proper POSTGRES_INITDB_ARGS for authentication - Handle pg_stat_statements extension gracefully if not available 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add PostgreSQL 17 support for pg_stat_checkpointer view changes - Handle checkpoints_timed -> num_timed column rename - Handle checkpoints_req -> num_requested column rename - Handle buffers_checkpoint -> buffers_written column rename - Make regression tests more flexible for version differences - Use pattern matching instead of exact value comparison 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Use server_version_num instead of table existence check - This avoids query planning errors when tables don't exist - PostgreSQL 17+ (170000+) uses pg_stat_checkpointer - Earlier versions use pg_stat_bgwriter 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Create temporary functions for version-specific queries - Functions execute queries at runtime, avoiding parse-time errors - Handles pg_stat_bgwriter vs pg_stat_checkpointer differences - Functions automatically clean up after query execution 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Update comment to remove CircleCI reference - Complete migration to GitHub Actions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Follow PostgreSQL version numbering (6.0 → 18.0) - Document comprehensive PostgreSQL 13-17 support - Record CircleCI to GitHub Actions migration - Note PostgreSQL 17 compatibility improvements - Mark as breaking change due to version jump 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove CREATE FUNCTION statements (no DDL allowed) - For PostgreSQL 17+: Show 'See pg_stat_checkpointer (PG17+)' message - For PostgreSQL <17: Continue using pg_stat_bgwriter normally - Maintains read-only nature of diagnostic tool 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Create dba_user with pg_monitor role instead of superuser - Grant minimal necessary privileges (CONNECT, USAGE, SELECT) - Test all SQL files with realistic non-admin user permissions - Add PostgreSQL 18beta1 to test matrix - Ensure postgres_dba works in real-world scenarios 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Update from 18beta1 to stable PostgreSQL 18 - Test complete PostgreSQL ecosystem: 13-18 - PostgreSQL 18 uses same pg_stat_checkpointer as 17 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Use WHERE clauses to completely exclude checkpoint queries for PG17+ - Avoids query parsing errors with non-existent columns - For PG17+: Shows informational note about pg_stat_checkpointer - For PG<17: Shows normal checkpoint statistics from pg_stat_bgwriter - No DDL required, purely conditional query execution 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
sql/0_node.sql
Outdated
| ) | ||
| case | ||
| when current_setting('server_version_num')::int >= 170000 | ||
| then 'See pg_stat_checkpointer (PG17+)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's implement it?
| done | ||
| # Check PostgreSQL version | ||
| psql -h localhost -U postgres -d test -c 'SELECT version();' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow SQL code style (check .cursor)
- Remove all references to checkpoints_timed, checkpoints_req, buffers_checkpoint - Show informational message directing users to appropriate views - PostgreSQL 17+: Use pg_stat_checkpointer view - PostgreSQL <17: Use pg_stat_bgwriter view - Ensures compatibility without DDL or parsing errors 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add postgres_dba_pgvers_17plus version variable to warmup.psql - Use \if conditionals to handle PostgreSQL 17+ vs <17 differences - PostgreSQL 17+: Use pg_stat_checkpointer (num_timed, num_requested, buffers_written) - PostgreSQL <17: Use pg_stat_bgwriter (checkpoints_timed, checkpoints_req, buffers_checkpoint) - Follow existing SQL code style and version handling patterns - Maintain all checkpoint statistics across versions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
✅ Already implemented! The latest commit (4c3bc28) includes proper checkpoint statistics for both versions: PostgreSQL 17+: Uses
PostgreSQL <17: Uses
Docker tested:
All 6 versions (13-18) now pass with actual checkpoint data! 🎉 |
- Change "Checkpoint MB/sec" to "Checkpoint MiB/sec" - Complies with project binary units standards (base-2) - Calculation uses 1024.0 * 1024, so MiB is accurate - Applies to both PostgreSQL 17+ and <17 versions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Document support for PostgreSQL 13-18 - Highlight PostgreSQL 17 pg_stat_checkpointer compatibility - Mention PostgreSQL 18 as latest supported version - Note that older versions may work but aren't actively tested - Provides clear version compatibility information for users 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Replace postgres-checkup reference with postgres_ai - Highlight comprehensive monitoring and optimization platform - Emphasizes broader feature set beyond just health checks - Points to current actively developed project 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Format pg_stat_checkpointer as code with backticks - Improves readability and follows markdown conventions - Consistent with PostgreSQL object naming standards 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Summary
Complete migration from CircleCI to GitHub Actions with comprehensive PostgreSQL testing and real-world privilege validation.
Key Features
pg_monitorrole instead of superuser to ensure real-world compatibilitypg_stat_bgwriter→pg_stat_checkpointermigrationChanges Made
GitHub Actions Workflow
dba_userwithpg_monitorrole for realistic testingCONNECT,USAGE,SELECTPostgreSQL Compatibility
pg_stat_checkpointerpg_stat_bgwriterserver_version_numReal-World Testing
pg_monitorrole (typical DBA permissions)Test Results
All PostgreSQL versions pass with minimal privileges:
pg_monitorpg_monitorpg_monitorpg_monitorpg_monitorpg_monitorMigration Notes
This ensures postgres_dba works reliably in production environments where users typically have monitoring privileges rather than full admin access.
🤖 Generated with Claude Code