On Thu, Apr 6, 2017 at 6:10 PM, Kevin Grittner <kgrittn@gmail.com> wrote:
> * About JOINs and dropped columns: although the parser never includes an
> * already-dropped column in a JOIN RTE's alias var list, it is possible for
> * such a list in a stored rule to include references to dropped columns.
> * (If the column is not explicitly referenced anywhere else in the query,
> * the dependency mechanism won't consider it used by the rule and so won't
> * prevent the column drop.) To support get_rte_attribute_is_dropped(), we
> * replace join alias vars that reference dropped columns with null pointers.
test=# create table t1 (t1id int not null, t1desc text);
CREATE TABLE
test=# create table t2 (t1id int not null, t2id int not null, t2desc text);
CREATE TABLE
test=# create view v1 as select t2desc from t1 join t2 on t1.t1id = t2.t1id;
CREATE VIEW
test=# alter table t1 drop column t1id;
ERROR: cannot drop table t1 column t1id because other objects depend on it
DETAIL: view v1 depends on table t1 column t1id
HINT: Use DROP ... CASCADE to drop the dependent objects too.
Is that comment wrong?
--
Kevin Grittner