Re: function depend on view

From: salah jubeh <s_jubeh(at)yahoo(dot)com>
To: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: function depend on view
Date: 2012-08-20 14:37:45
Message-ID: 1345473465.18559.YahooMailNeo@web122203.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Andreas,

Thanks for the reply,  The example I have posted is very simple and you are right it is very similar to select max (id) from table_that_does_not_exist; But there are more here, for example imagine I have something like

CREATE VIEW a4 as select .... from  a3(), .... ;

In my opinion, this might leads to many problems such as

1.  A lot of garbage in the database including functions refers to non existing objects and views defined over these functions.
2.  This might also lead to some logical errors; especially, if you have a view defined over such functions and used in external applications.

3.  You will get also a broken dependency graph, in the above example it is obvious that a4 depends on a3 which depends on a2.  

Regards

________________________________
From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-general(at)postgresql(dot)org
Sent: Monday, August 20, 2012 2:47 PM
Subject: Re: [GENERAL] function depend on view

salah jubeh <s_jubeh(at)yahoo(dot)com> wrote:

> 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

I think, there is no real problem, it's (for me) the same as:

test=# select max(id) from table_that_does_not_exist;
ERROR:  relation "table_that_does_not_exist" does not exist
LINE 1: select max(id) from table_that_does_not_exist;

The database can't know and analyse the function-body.

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."  (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2012-08-20 14:57:57 Re: function depend on view
Previous Message Achilleas Mantzios 2012-08-20 14:34:47 Re: Different results from view and from its defintion query [w/ windowing function]