Skip to content

[Bug]: PostgresTable::getSequence() always returns null #305

Open

Description

@roxblnfk

Describe the bug

PostgresTable::getSequence() always returns null. The primary sequence is only assigned inside fetchPrimaryKeys() behind if (\is_array($this->primarySequence) && …) (src/Driver/Postgres/Schema/PostgresTable.php:254), but the property is ?string and starts as null, so the condition is never true and $this->primarySequence = $this->sequences[$column] never runs.

Is this a regression?

Not checked.

To Reproduce

  1. Postgres table with a serial/bigserial primary key.
  2. $db->table('users')->getSchema()->getSequence().
  3. Returns null instead of users_id_seq.

Expected behaviour

The name of the primary key's sequence, as the docblock says ("required by ORM to correctly resolve inserted row id").

Media prove

Not applicable.

Database

PostgreSQL.

Your environment

cycle/database 2.x, src/Driver/Postgres/Schema/PostgresTable.php:254.

Additional context

Found while raising coverage in #304. The check probably meant $this->primarySequence === null.

Activity

  1. added
    status:to be verified
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:to be verifiedtype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions