postgresql: no foreign tables shown in database tree

dmelcher's profile image dmelcher posted 3 weeks ago in General Permalink

Preconditions HeidiSQL version: 12.20.0.6905 (regression — worked fine in 12.6.0) Database type and version: PostgreSQL (server uses postgres_fdw or similar FDW extension) OS: Windows

Describe the bug After upgrading from HeidiSQL 12.6.0 to 12.20.0, foreign tables are no longer displayed in the database tree on the left side. Only regular base tables and views are shown. In my database, only 5 objects are relkind = 'r' (base tables), while the majority of objects are relkind = 'f' (foreign tables, created via a foreign data wrapper). These foreign tables were correctly listed in the tree under "Tables" in HeidiSQL 12.6.0, but are completely missing in 12.20.0 — they don't appear under Tables, Views, or any other node.

To Reproduce

  1. Connect to a PostgreSQL database that contains foreign tables (e.g. via postgres_fdw, CREATE FOREIGN TABLE ...)
  2. Expand the database in the tree on the left
  3. Observe: foreign tables are missing; only regular tables and views appear

Expected behavior Foreign tables should be listed in the tree, as they were in HeidiSQL 12.6.0 — either under "Tables" or in a dedicated "Foreign tables" node.

Verification Querying information_schema.tables directly confirms the foreign tables exist and are queryable (shown as table_type = 'FOREIGN'), and pg_catalog.pg_class confirms them as relkind = 'f'. So the objects are present and accessible via SQL — they're just not picked up by HeidiSQL's tree-building query anymore.

Screenshots / Crash reports n/a

ansgar's profile image ansgar posted 3 weeks ago Permalink

worked fine in 12.6.0

you skipped 14 releases?

But yes, for issue #1880 / v12.16 I took the chance and refactored the query for retrieving tables and views. Previously it was querying IS.TABLES, and now it's pg_class.

I have no clue what foreign tables are, but I assume things went wrong when such a foreign table was double-clicked, or was the normal table editor able to display and edit such tables?

dmelcher's profile image dmelcher posted 3 weeks ago Permalink

you skipped 14 releases?

I am afraid I did ...

In Version 12.6.xxx the materialized views where missing. I seems that materialized views is a postgresql-special.

In version 12.20.xxx the materialized views where visible but the foreing tables where missing in the database tree. However there is no problem to access them via database queries.

Here is a select-statement that should take into account every database object in postgresql

SELECT n.nspname AS table_schema, c.relname AS table_name, CASE c.relkind WHEN 'r' THEN 'BASE TABLE' WHEN 'v' THEN 'VIEW' WHEN 'm' THEN 'MATERIALIZED VIEW' WHEN 'f' THEN 'FOREIGN TABLE' WHEN 'p' THEN 'PARTITIONED TABLE' END AS table_type FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r', 'v', 'm', 'f', 'p') AND n.nspname NOT IN ('pg_catalog', 'information_schema') ORDER BY table_schema, table_type, table_name;

Please login to leave a reply, or register at first.