Skip to content

Querying information_schema.tables.is_insertable_into with vsizip datasource errors #221

@robe2

Description

@robe2
CREATE EXTENSION ogr_fdw;
CREATE SCHEMA staging;
DROP SERVER IF EXISTS fds_ne CASCADE;
CREATE SERVER fds_ne 
    FOREIGN DATA WRAPPER ogr_fdw
    OPTIONS(datasource '/vsizip//vsicurl/http://postgis.us/downloads/ne_10m_admin_1_states_provinces.zip', format 'ESRI Shapefile');

IMPORT FOREIGN SCHEMA ogr_all FROM SERVER fds_ne INTO staging; 

I also tried with: datasources which are equivalent: /fdw_data/argentina-latest-free.shp.zip and /vsizip//fdw_data/argentina-latest-free.shp.zip. Both work as far as linking and querying but the one with /vsizip chokes in the information_schema.tables query

CREATE SERVER fds_ne 
    FOREIGN DATA WRAPPER ogr_fdw
    OPTIONS(datasource '/vsizip//http://postgis.us/downloads/ne_10m_admin_1_states_provinces.zip', format 'ESRI Shapefile');

Works fine outputs:

NOTICE:  Number of tables to be created 1
IMPORT FOREIGN SCHEMA

This also works:

SELECT f_table_name, f_geometry_column, coord_dimension, srid, type 
FROM geometry_columns 
WHERE f_table_schema = 'staging';

This gives error, but leaving out the is_insertable_into column, it works okay

SELECT table_name, table_type, is_insertable_into 
FROM information_schema.tables 
WHERE table_schema = 'staging';

Error:

ERROR:  GDAL OpenFailed [4] Unable to open /vsizip//vsicurl/http://postgis.us/downloads/ne_10m_admin_1_states_provinces.zip/ne_10m_admin_1_states_provinces.shp or /vsizip//vsicurl/http://postgis.us/downloads/ne_10m_admin_1_states_provinces.zip/ne_10m_admin_1_states_provinces.SHP.
SQL state: XX000

Expected behavior is the query does not error and the is_insertable_into has a false in output because vszip are not editable.

My Version info

SELECT ogr_fdw_version();

outputs:

OGR_FDW="1.1" GDAL="3.2.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions