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

pgsql: metaTables() returns duplicated views #972

Open
1 task done
dregad opened this issue May 21, 2023 · 1 comment · May be fixed by #1008
Open
1 task done

pgsql: metaTables() returns duplicated views #972

dregad opened this issue May 21, 2023 · 1 comment · May be fixed by #1008
Assignees
Labels
bug pgsql PostgreSQL (Tier 1)
Milestone

Comments

@dregad
Copy link
Member

dregad commented May 21, 2023

Description

When executed with $ttype = false on PostgreSQL driver, database views are listed twice in the array returned by metaTables() method.

Environment

  • ADOdb version: 5.22.5
  • Driver or Module: postgres
  • Database type and version: PostgreSQL > 7.3
  • PHP version: any
  • Platform: any
  • I have tested that the problem is reproducible in the master branch and hotfix branch

Steps to reproduce

A database containing at least one view (here, I have 2 tables test, test2 and a view v_test2)

print_r($db->metaTables();

Script output

Array
(
    [0] => v_test2
    [1] => test
    [3] => test2
    [4] => v_test2
)

Expected behavior

List all tables and views without duplicates

@dregad dregad added bug pgsql PostgreSQL (Tier 1) triage New issues not yet reviewed by ADOdb developers labels May 21, 2023
@dregad dregad added this to the v5.23.0 milestone May 21, 2023
@dregad dregad self-assigned this May 21, 2023
@dregad
Copy link
Member Author

dregad commented May 21, 2023

This bug is present since v5.12, when commit 511d2da introduced use of information_schema instead of pg_catalog to retrieve tables metadata.

Considering how long it's been out there without anyone complaining about it, and the pending refactor of PostgreSQL driver (#955), I'm targeting this at 5.23 instead of the hotfix branch as I normally would.

dregad added a commit to dregad/ADOdb that referenced this issue Jun 11, 2023
The information_schema's tables view already contains the views, so
there is no need for an UNION query. The object's type (table/view) is
stored in the table_type column.

The metaTablesSQL query was modified accordingly.

Fixes ADOdb#972
dregad added a commit to dregad/ADOdb that referenced this issue Jun 12, 2023
The information_schema's tables view already contains the views, so
there is no need for an UNION query. The object's type (table/view) is
stored in the table_type column.

The metaTablesSQL query was modified accordingly.

Fixes ADOdb#972
@dregad dregad removed the triage New issues not yet reviewed by ADOdb developers label Jun 29, 2023
dregad added a commit to dregad/ADOdb that referenced this issue Nov 4, 2023
The information_schema's tables view already contains the views, so
there is no need for an UNION query. The object's type (table/view) is
stored in the table_type column.

The metaTablesSQL query was modified accordingly.

Fixes ADOdb#972
@dregad dregad linked a pull request Nov 5, 2023 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug pgsql PostgreSQL (Tier 1)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant