Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.6.x] Fixed #20829 -- Skip postgis metadata tables with introspection

Backport of 2408861 from master.
  • Loading branch information...
commit a6ac4f90d0d09da884289d6f03df4e4800c8f742 1 parent 1b48de0
Urth authored July 31, 2013 claudep committed August 16, 2013
8  django/contrib/gis/db/backends/postgis/introspection.py
@@ -9,6 +9,14 @@ class PostGISIntrospection(DatabaseIntrospection):
9 9
     # introspection is actually performed.
10 10
     postgis_types_reverse = {}
11 11
 
  12
+    ignored_tables = DatabaseIntrospection.ignored_tables + [
  13
+        'geography_columns',
  14
+        'geometry_columns',
  15
+        'raster_columns',
  16
+        'spatial_ref_sys',
  17
+        'raster_overviews',
  18
+    ]
  19
+
12 20
     def get_postgis_types(self):
13 21
         """
14 22
         Returns a dictionary with keys that are the PostgreSQL object
6  django/db/backends/postgresql_psycopg2/introspection.py
@@ -25,7 +25,9 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
25 25
         1266: 'TimeField',
26 26
         1700: 'DecimalField',
27 27
     }
28  
-        
  28
+
  29
+    ignored_tables = []
  30
+
29 31
     def get_table_list(self, cursor):
30 32
         "Returns a list of table names in the current database."
31 33
         cursor.execute("""
@@ -35,7 +37,7 @@ def get_table_list(self, cursor):
35 37
             WHERE c.relkind IN ('r', 'v', '')
36 38
                 AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
37 39
                 AND pg_catalog.pg_table_is_visible(c.oid)""")
38  
-        return [row[0] for row in cursor.fetchall()]
  40
+        return [row[0] for row in cursor.fetchall() if row[0] not in self.ignored_tables]
39 41
 
40 42
     def get_table_description(self, cursor, table_name):
41 43
         "Returns a description of the table, with the DB-API cursor.description interface."

0 notes on commit a6ac4f9

Please sign in to comment.
Something went wrong with that request. Please try again.