mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.6.x] Fixed #20829 -- Skip postgis metadata tables with introspection
Backport of 24088618 from master.
			
			
This commit is contained in:
		
				
					committed by
					
						 Claude Paroz
						Claude Paroz
					
				
			
			
				
	
			
			
			
						parent
						
							1b48de06c3
						
					
				
				
					commit
					a6ac4f90d0
				
			| @@ -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 | ||||
|   | ||||
| @@ -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." | ||||
|   | ||||
		Reference in New Issue
	
	Block a user