Skip to content

Foreign Table not recognized as such #278

Description

@FranckPachot

Describe the bug

The Foreign Data Wrapper tables are displayed like tables, but their properties are not correct. For example. nothing displayed in properties

Image

The Create Script fails with:

Error running command pgsql.scriptCreate: 'NoneType' object has no attribute 'get'. This is likely caused by the extension that contributes pgsql.scriptCreate.

To Reproduce

CREATE EXTENSION IF NOT EXISTS postgres_fdw;


CREATE SERVER s
  FOREIGN DATA WRAPPER postgres_fdw
  OPTIONS (
    host 'localhost',
    port '5432',
    dbname 'postgres'
  );

CREATE USER MAPPING FOR current_user
  SERVER s
  OPTIONS (
    user 'postgres',
    password 'xxx' --------------> change to your password
  );

CREATE SCHEMA IF NOT EXISTS schema1;

CREATE SCHEMA IF NOT EXISTS schema2;

CREATE TABLE schema1.t AS SELECT 'Hello World' AS message;

IMPORT FOREIGN SCHEMA schema1
  FROM SERVER s
  INTO schema2;

EXPLAIN SELECT * FROM schema1.t;    --------> should show Seq Scan

EXPLAIN SELECT * FROM schema2.t;    --------> should show Foreign Scan

Then click on the schema2 table t and try the different actions

Expected behavior

I think they should show in a Foreign Table list rather than with Table, and properties / create script should work

VS Code version

Extension version 1.24

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions