Skip to content

[BUG]: listTables() lists MariaDB sequences and PostgreSQL partitions #17769

Done

Description

@niden

Describe the bug
listTables() gives objects that are not tables:

  • MariaDB: the MySQL dialect runs SHOW TABLES, which also lists the sequences.
  • PostgreSQL: the dialect reads information_schema.tables with no filter on the type. It lists each partition of a partitioned table as a BASE TABLE, next to the parent table.

To Reproduce

MariaDB 10.6.28:

CREATE SEQUENCE s1;
CREATE TABLE t1 (id INT PRIMARY KEY);

The query of the MySQL dialect (SHOW TABLES) gives s1 and t1. SHOW FULL TABLES gives s1 as a SEQUENCE.

PostgreSQL 18.7:

CREATE TABLE m (id int, d date) PARTITION BY RANGE (d);
CREATE TABLE m_2026_01 PARTITION OF m FOR VALUES FROM ('2026-01-01') TO ('2026-02-01');
CREATE TABLE m_2026_02 PARTITION OF m FOR VALUES FROM ('2026-02-01') TO ('2026-03-01');

The query of the PostgreSQL dialect gives m, m_2026_01 and m_2026_02, each a BASE TABLE. A sequence is not listed.

Expected behavior
listTables() gives no sequences and no partitions. The views stay as they are today (MySQL and PostgreSQL list them), so this is no change for the views.

A possible fix:

  • MySQL dialect: SHOW FULL TABLES ... WHERE Table_type <> 'SEQUENCE', and only the first column is read.
  • PostgreSQL dialect: leave out the partitions (pg_class.relispartition).

Details

  • Phalcon version: 5.0.x (cfcf481836): phalcon/Db/Dialect/Mysql.zep and phalcon/Db/Dialect/Postgresql.zep, listTables(). phalcon/phalcon v6.0.x has the same queries (src/Db/Dialect/Mysql.php, src/Db/Dialect/Postgresql.php).

Additional context
Found in phalcon/crest#88: crest make:model --all writes a model for each MariaDB sequence and for each PostgreSQL partition. A table with 24 monthly partitions gives 25 models.

Activity

  1. self-assigned this
    on Nov 22, 2026
  2. added
    bug
    5.0
    on Nov 22, 2026
  3. added theissue type on Nov 22, 2026
  4. moved this from Backlog to Active Sprint in Phalcon v5on Nov 24, 2026
  5. niden commented on Nov 25, 2026

    @niden
    SponsorMemberAuthor

    Resolved in #17792

  6. moved this from Active Sprint to Implemented in Phalcon v5on Nov 25, 2026
  7. added 2 commits that reference this issue on Nov 28, 2026
  8. moved this from Implemented to Released in Phalcon v5on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

5.0bugstatus: low

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions