Skip to content

Sequence name undo_log_id_seq in PostgresqlUndoLogManager breaks custom undo_log table configuration #7581

@w1397800

Description

@w1397800

Check Ahead

  • I have searched the issues of this repository and believe that this is not a duplicate.

  • I am willing to try to fix this bug myself.

Ⅰ. Issue Description

I found that in the PostgresqlUndoLogManager class, the sequence name undo_log_id_seq used in the insert SQL statement is hardcoded:

INSERT INTO undo_log (...) VALUES (nextval('undo_log_id_seq'), ...)

This causes an issue when the undo log table name is customized via configuration (e.g., in application.yml). Because the sequence name does not update to match the new table name, insert operations fail or behave incorrectly.

Steps to reproduce:

  1. Configure Seata to use a custom undo log table name, for example my_undo_log.
  2. The sequence name remains hardcoded as undo_log_id_seq in the SQL.
  3. On insert, PostgreSQL throws an error because the sequence undo_log_id_seq does not exist or does not match the new table.

Expected behavior:

  • The sequence name used in the insert SQL should be dynamically derived from the configured undo log table name, for example my_undo_log_id_seq for table my_undo_log.
  • This would make the undo log manager compatible with table name customization.

Suggested fix:

  • Make the sequence name configurable or derived from the undo log table name dynamically.
  • Update the insert SQL statement in PostgresqlUndoLogManager accordingly.

Ⅱ. Describe what happened

No response

Ⅲ. Describe what you expected to happen

No response

Ⅳ. How to reproduce it (as minimally and precisely as possible)

No response

Ⅴ. Anything else we need to know?

No response

Ⅵ. Environment

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions