diff --git a/geopetl/postgis.py b/geopetl/postgis.py index d87a95c..b5dc250 100644 --- a/geopetl/postgis.py +++ b/geopetl/postgis.py @@ -602,6 +602,11 @@ def geom_field(self): stmt = '''select f_geometry_column as column_name from geometry_columns where f_table_name = '{table_name}' and f_table_schema = '{table_schema}' '''.format(table_name=self.name, table_schema=self.schema) target_table_shape_fields = self.db.fetch(stmt) + # Could be an odd situation where we have a non-registered table, but the table still has postgis geometry. + if self.db.is_postgis_enabled and not target_table_shape_fields: + stmt = '''select f_geometry_column as column_name from geometry_columns + where f_table_name = '{table_name}' and f_table_schema = '{table_schema}' '''.format(table_name=self.name, table_schema=self.schema) + target_table_shape_fields = self.db.fetch(stmt) elif self.db.is_postgis_enabled: # this query should work for both postgis mview and table