[postgis-users] OGR_FDW Question

Regina Obe lr at pcorp.us
Thu Mar 18 22:12:37 PDT 2021

What does your FOREIGN SERVER def look like


For PostgresQL 9.5 and above I usually do:


IMPORT FOREIGN SCHEMA ogr_all FROM  SERVER “geojsonfile” INTO staging;


So I don’t have to figure out layer names or table structure.  That should work here too.


Then once the layer name and table has been created, assuming it’s just one table, you can always rename it doing:


ALTER TABLE some_table RENAME to area;


From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Simon SPDBA Greener
Sent: Thursday, March 18, 2021 9:21 PM
To: postgis-users at lists.osgeo.org
Subject: [postgis-users] OGR_FDW Question


I have a geojson file whose contents don't have a "layer" name:


When I try to wrap it....

  name     varchar(100),
  imported boolean,
  id       integer,
  geom     geometry
) SERVER "geojsonfile"
OPTIONS (layer '');

I get.... 


ERROR:  unable to connect to layer to ""
HINT:  Does the layer exist?
SQL state: HV00R

I don't want to edit the file to add a name as this is provided by an external source:

{"type":"FeatureCollection","name": "area","features":....

What is the correct way to specify the foreign table OPTIONS to allow access to a GeoJson without a name?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20210319/68089c74/attachment.html>

More information about the postgis-users mailing list