pgsql: When converting a table to a view, remove its system columns.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: When converting a table to a view, remove its system columns.
Date: 2012-10-24 17:39:50
Message-ID: E1TR4vm-00065D-69@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a4e8680a6c337955c021177457147f4b4d9a5df5

Modified Files
--------------
src/backend/catalog/heap.c | 41 +++++++++++++++++++++++++++++++++++
src/backend/rewrite/rewriteDefine.c | 11 +++++++-
src/include/catalog/heap.h | 1 +
src/test/regress/expected/rules.out | 22 ++++++++++++++++++
src/test/regress/sql/rules.sql | 15 ++++++++++++
5 files changed, 88 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2012-10-24 18:54:50 pgsql: Prevent parser from believing that views have system columns.
Previous Message Alvaro Herrera 2012-10-23 21:30:01 pgsql: Add context info to OAT_POST_CREATE security hook