diff options
| author | Harm Geerts <github@geertswei.nl> | 2013-07-31 22:35:44 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-08-16 21:14:29 +0200 |
| commit | 240886183b022055b5a5115916c7c9766ec55c51 (patch) | |
| tree | 3a44c464f5d802fc0b4803223e9a2de0cebb5454 | |
| parent | 165f44aaaa0b9008f35d8f6a3474db061559ad53 (diff) | |
Fixed #20829 -- Skip postgis metadata tables with introspection
| -rw-r--r-- | django/contrib/gis/db/backends/postgis/introspection.py | 8 | ||||
| -rw-r--r-- | django/db/backends/postgresql_psycopg2/introspection.py | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/django/contrib/gis/db/backends/postgis/introspection.py b/django/contrib/gis/db/backends/postgis/introspection.py index 7962d19ff9..7df09d0937 100644 --- a/django/contrib/gis/db/backends/postgis/introspection.py +++ b/django/contrib/gis/db/backends/postgis/introspection.py @@ -9,6 +9,14 @@ class PostGISIntrospection(DatabaseIntrospection): # introspection is actually performed. postgis_types_reverse = {} + ignored_tables = DatabaseIntrospection.ignored_tables + [ + 'geography_columns', + 'geometry_columns', + 'raster_columns', + 'spatial_ref_sys', + 'raster_overviews', + ] + def get_postgis_types(self): """ Returns a dictionary with keys that are the PostgreSQL object diff --git a/django/db/backends/postgresql_psycopg2/introspection.py b/django/db/backends/postgresql_psycopg2/introspection.py index 0ebd3c1ed5..2401785314 100644 --- a/django/db/backends/postgresql_psycopg2/introspection.py +++ b/django/db/backends/postgresql_psycopg2/introspection.py @@ -26,6 +26,8 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): 1700: 'DecimalField', } + ignored_tables = [] + def get_table_list(self, cursor): "Returns a list of table names in the current database." cursor.execute(""" @@ -35,7 +37,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): WHERE c.relkind IN ('r', 'v', '') AND n.nspname NOT IN ('pg_catalog', 'pg_toast') AND pg_catalog.pg_table_is_visible(c.oid)""") - return [row[0] for row in cursor.fetchall()] + return [row[0] for row in cursor.fetchall() if row[0] not in self.ignored_tables] def get_table_description(self, cursor, table_name): "Returns a description of the table, with the DB-API cursor.description interface." |
