When converting a table to a view, remove its system columns.
Tom Lane <tgl@sss.pgh.pa.us>
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.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/catalog/heap.c | modified | +41 −0 |
| src/backend/rewrite/rewriteDefine.c | modified | +9 −2 |
| src/include/catalog/heap.h | modified | +1 −0 |
| src/test/regress/expected/rules.out | modified | +22 −0 |
| src/test/regress/sql/rules.sql | modified | +15 −0 |