Bug #759: 7.3beta1 DROP COLUMN DEPENDENCY PROBLEM - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #759: 7.3beta1 DROP COLUMN DEPENDENCY PROBLEM
Date
Msg-id 20020906083136.BB12F476483@postgresql.org
Whole thread Raw
Responses Re: Bug #759: 7.3beta1 DROP COLUMN DEPENDENCY PROBLEM  (Rod Taylor <rbt@zort.ca>)
Re: Bug #759: 7.3beta1 DROP COLUMN DEPENDENCY PROBLEM  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Tim Knowles (tim@ametco.co.uk) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
7.3beta1 DROP COLUMN DEPENDENCY PROBLEM

Long Description
Hi,

Been playing with the 7.3beta1 version and I've noticed a small problem with dependency checking when dropping a
column. If you have a view which uses JOIN's to join tables then dropping a column will fail on a dependency check,
eventhough the column being dropped is not used at all in the view.  If you join the tables in the WHERE clause the
columncan be dropped without problems. 

Please see below some example SQL to demonstrate:

Sample Code
-- wrap it all up in a transaction so we don't do anything permanent

BEGIN;

CREATE TABLE table1 (col_a text, col_b int);
CREATE TABLE table2 (col_b int, col_c text);

CREATE VIEW tester1 AS SELECT A.col_a,B.col_b FROM table1 A, table2 B WHERE (b.col_b=a.col_b);

CREATE VIEW tester2 AS SELECT A.col_a,B.col_b FROM table2 B INNER JOIN table1 A ON (b.col_b=a.col_b);

--Now try and drop column col_c from table2
ALTER TABLE table2 DROP COLUMN col_c RESTRICT;

--You should now get an error to say that col_c is a dependent object in view tester2

ROLLBACK;

No file was uploaded with this report

pgsql-bugs by date:

Previous
From: Bruno Wolff III
Date:
Subject: atan2 documentation bugs for 7.3 and 7.2
Next
From: Rod Taylor
Date:
Subject: Re: Bug #759: 7.3beta1 DROP COLUMN DEPENDENCY PROBLEM