﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6730	postgresql_psycopg2 introspection includes views in generated models	Michael van der Westhuizen <r1mikey@…>	nobody	"It's a little unexpected that inspectdb for psycopg2 includes views in its output. This is also inconsistent with the Oracle backend. The following patch corrects this behavior and gives me the results I expect:

{{{
Index: django/db/backends/postgresql_psycopg2/introspection.py
===================================================================
--- django/db/backends/postgresql_psycopg2/introspection.py	(revision 7196)
+++ django/db/backends/postgresql_psycopg2/introspection.py	(working copy)
@@ -8,7 +8,7 @@
         SELECT c.relname
         FROM pg_catalog.pg_class c
         LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
-        WHERE c.relkind IN ('r', 'v', '')
+        WHERE c.relkind = 'r'
             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()]
}}}
"	Cleanup/optimization	closed	Core (Management commands)	dev	Normal	fixed	inspectdb		Accepted	1	0	0	1	0	0
