Skip to content
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

Bug Report: Uninitialized Value in is_autoinc Method ( PostgreSQL Migration ) #1941

Open
Diogo-Rego opened this issue Mar 3, 2025 · 0 comments
Labels

Comments

@Diogo-Rego
Copy link

Use of uninitialized value $field in string eq at Sympa/DatabaseDriver/PostgreSQL.pm line 155

Version

  • Sympa: v6.2.72
  • PostgreSQL: v14
  • OS: Ubuntu-24.04

Installation method

Installed via: [ source code ]

Expected behavior

The is_autoinc function should correctly check whether a database field is an autoincrement column without causing warnings, even on the first database migration.

Actual behavior

Sympa logs the following warning when checking for autoincrement fields:

Use of uninitialized value $field in string eq at /opt/sympa/share/sympa/lib/Sympa/DatabaseDriver/PostgreSQL.pm line 155.

However, if a second migration is attempted, the error does not appear again.

This suggests that the required database sequences might not exist or be detected properly during the initial migration but are available afterward.

Steps to reproduce

  1. Perform the first database migration for Sympa with PostgreSQL.
  2. Observe the warning in the logs.
  3. Perform a second migration.
  4. Notice that the warning does not appear again.

Additional information

The issue is located in Sympa/DatabaseDriver/PostgreSQL.pm, specifically in the is_autoinc function.
A possible fix is to check if $field is defined before performing the comparison:

my $field = $sth->fetchrow();
return (defined $field && $field eq $seqname);

Since this only happens during the first migration, it is possible that some tables or sequences are not created yet at the moment this function runs. Adding a debug log before executing the SQL query could help confirm this hypothesis.

@Diogo-Rego Diogo-Rego added the bug label Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant