Rules containing INSERT/UPDATE lack dependencies on target columns - Mailing list pgsql-hackers

From Tom Lane
Subject Rules containing INSERT/UPDATE lack dependencies on target columns
Date
Msg-id 3781.1331320481@sss.pgh.pa.us
Whole thread Raw
Responses Re: Rules containing INSERT/UPDATE lack dependencies on target columns  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
I looked into the misbehavior reported here:
http://archives.postgresql.org/pgsql-bugs/2012-03/msg00068.php

The reason the ALTER TABLE fails to fail is $SUBJECT: it goes looking
for pg_depend entries showing that rewrite rules depend on the column to
be altered, but there isn't one.  This is basically because dependency.c
only generates column dependencies for Vars, and the representation of
an INSERT or UPDATE does not use a Var to specify a target column.

ISTM we need to add such dependencies.  Aside from the change-of-type
issue reported above, you can get very curious behavior if you remove a
target column with ALTER TABLE DROP COLUMN, and I don't think we want to
allow that.

I'm inclined to only fix this in HEAD.  Back-patching would have limited
usefulness since it wouldn't cause the missing pg_depend entries to
spring into existence for existing rules; and given the lack of prior
reports, it's clearly not something that comes up often.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: elegant and effective way for running jobs inside a database
Next
From: Robert Haas
Date:
Subject: Re: Command Triggers, patch v11