Re: function depend on view - Mailing list pgsql-general

From salah jubeh
Subject Re: function depend on view
Date
Msg-id 1345473465.18559.YahooMailNeo@web122203.mail.ne1.yahoo.com
Whole thread Raw
In response to Re: function depend on view  (Andreas Kretschmer <akretschmer@spamfence.net>)
Responses Re: function depend on view  (Merlin Moncure <mmoncure@gmail.com>)
Re: function depend on view  (Andreas Kretschmer <akretschmer@spamfence.net>)
List 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@spamfence.net>
To: pgsql-general@postgresql.org
Sent: Monday, August 20, 2012 2:47 PM
Subject: Re: [GENERAL] function depend on view

salah jubeh <s_jubeh@yahoo.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°


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Views versus user-defined functions: formatting, comments, performance, etc.
Next
From: Merlin Moncure
Date:
Subject: Re: function depend on view