function depend on view

From: salah jubeh <s_jubeh(at)yahoo(dot)com>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: function depend on view
Date: 2012-08-20 12:14:00
Message-ID: 1345464840.26018.YahooMailNeo@web122205.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Guys,

I am having a scenario close to the one below, I have defined a function which depends on a view. I am able to drop the view, but my server did not complain about the dependency.

In the scenario  below, one can drop the views a2 and a1 respectively, and when executing a3(), certainly an exception will be raised. I think there should be an entry for this dependency in the pg_depend table with dependency type normal

CREATE TABLE a (
 id serial,
 name text
);

CREATE view a1 as select * FROM a;
CREATE view a2 as SELECT * FROM a1;

CREATE OR REPLACE FUNCTION a3 () RETURNS INTEGER AS
$$
select MAX (id) FROM a2;
$$
LANGUAGE 'sql';

DROP VIEW  a2;
DROP VIEW  a1;
SELECT * FROM a3();

Regards

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2012-08-20 12:47:25 Re: function depend on view
Previous Message Johann Spies 2012-08-20 08:04:53 Re: Visualize database schema