Skip to content

PostgreSQL compatibility issues in CI and SQL profiling #2185

@abdibaker

Description

@abdibaker

Problem Description

The CI pipeline has several PostgreSQL compatibility issues that cause test failures:

1. Database Connection Error

FATAL: role "root" does not exist

The PostgreSQL test jobs are trying to connect using the "root" user, but PostgreSQL uses "debug_toolbar" user as configured in the service definition.

2. SQL Profiling Compatibility Error

unrecognized configuration parameter "profiling"

The SQL panel's profiling feature uses MySQL-specific commands (SET PROFILING=1/0 and information_schema.profiling) that don't exist in PostgreSQL.

3. User Creation Constraint Violations

duplicate key value violates unique constraint "auth_user_username_key"

Test isolation issues causing duplicate user creation attempts.

Environment

  • CI Environment: GitHub Actions
  • Database: PostgreSQL 14 with PostGIS
  • Affected Test Jobs: All PostgreSQL matrix variants
  • Python Versions: 3.9, 3.10, 3.11, 3.12, 3.13

Root Causes

  1. Missing Environment Variables: PostgreSQL CI jobs don't set DB_NAME, DB_USER, DB_PASSWORD environment variables, unlike MySQL jobs
  2. Database-Specific Code: SQL profiling assumes MySQL without vendor detection
  3. CI Configuration: Lint job has malformed strategy configuration

Proposed Solution

1. Fix CI Configuration

  • Add missing PostgreSQL environment variables to .github/workflows/test.yml
  • Fix lint job strategy configuration

2. Fix SQL Profiling

  • Add vendor detection to debug_toolbar.panels.sql.forms.SQLSelectForm.profile()
  • Raise clear error message for non-MySQL databases
  • Update error handling in views

3. Add Tests

  • Add PostgreSQL compatibility tests to verify fixes
  • Test that profiling correctly rejects non-MySQL databases

Impact

  • High: Blocks all PostgreSQL CI jobs
  • Scope: Affects testing reliability and PostgreSQL users
  • Regression Risk: Low - changes are defensive and add proper error handling

Implementation Plan

  1. ✅ Identify root causes
  2. ✅ Fix SQL profiling vendor detection
  3. ✅ Update CI configuration
  4. ✅ Add comprehensive tests
  5. 🔄 Create PR with fixes

The fix maintains backward compatibility while providing proper error messages for unsupported database operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions