1

(cross-posted from SO https://stackoverflow.com/q/55869582/2802810)

I've accidentally dropped geometry_columns and geography_columns tables from an existing PostgreSQL PostGIS database schema - let's call it mydb.myschema.

This post outlines how to restore using CREATE TABLE ... with .sql from PostGIS install (I am on a shared server and am having to get my devops to look for them because of permissions).

I wanted to check if this will work. Also, do these two tables (geometry_columns and geography_columns) contain data relating to the geometries held in existing tables in mydb.myschema. Or do geometry_columns and geography_columns hold reference information for spatial operations?

Any advice from anyone who has gone through this before?

Running PostGIS 2.5.2 on PG 11.x.

[NOTE: No backup available as snapshots weren't set up beforehand...]

  • Found SQL on my server to re-generate these two as VIEWS. So the tables hold information about geometry as per OGC Simple Features specification see gis.stackexchange.com/a/54849/104667. Is there anything I've missed though I wonder? – mark Apr 26 at 16:08
1

The post you linked to is outdated; nowadays, geomtry_columns and geography_columns are views that automatically extract their data from the Postgres system tables.

You should be able to find the CREATE OR REPLACE VIEW statements in the file share/contrib/postgis-x.x/postgis.sql in your Postgres installation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.