When converting a table to a view, remove its system columns.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 24 Oct 2012 17:39:37 +0000 (13:39 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 24 Oct 2012 17:39:37 +0000 (13:39 -0400)
commita4e8680a6c337955c021177457147f4b4d9a5df5
treedc8d6dbb7a9ddaa04c300043483e62e8e9d4cd92
parentf4c4335a4aaf5f2ee6e741cdf4f5c8e338d86a2f
When converting a table to a view, remove its system columns.

Views should not have any pg_attribute entries for system columns.
However, we forgot to remove such entries when converting a table to a
view.  This could lead to crashes later on, if someone attempted to
reference such a column, as reported by Kohei KaiGai.

Patch in HEAD only.  This bug has been there forever, but in the back
branches we will have to defend against existing mis-converted views,
so it doesn't seem worthwhile to change the conversion code too.
src/backend/catalog/heap.c
src/backend/rewrite/rewriteDefine.c
src/include/catalog/heap.h
src/test/regress/expected/rules.out
src/test/regress/sql/rules.sql