Re: Why does an ON SELECT rule have to be named "_RETURN"? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Why does an ON SELECT rule have to be named "_RETURN"?
Date
Msg-id 20060216125439.GF26127@svana.org
Whole thread Raw
In response to Re: Why does an ON SELECT rule have to be named "_RETURN"?  (Robert Treat <xzilla@users.sourceforge.net>)
Responses Re: Why does an ON SELECT rule have to be named "_RETURN"?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Thu, Feb 16, 2006 at 07:28:20AM -0500, Robert Treat wrote:
> On Monday 13 February 2006 01:49, Peter Eisentraut wrote:
> > First of all, it isn't all that hard to figure out whether a view is
> > probably updatable (the presence of the respective rules would be a
> > strong hint).  And second, if it's not, you get a fine error message
> > and can move on.  So there is really no good reason for client tools to
> > prevent you from using data entry forms on views.
>
> One problem is the only way for a client tool to work generically in provding
> data entry forms would be to provide entry for all columns, which would break
> in all but the most trivial of cases.  Last time we discussed this for
> phppgadmin, the general opinion was it wasn't worth trying to work around
> postgresql core's deficiency. Once the core postgresql server supports
> updatable views in proper, I'd imagine this would get done.

True, but the client should allow it (possibly with a warning). Not
allowing people to generate forms on a view just because it may not be
updatable seems silly... There's plenty of info on how to create
updatable views on PostgreSQL, allowing users to indicate themselves
which fields are updatable seems better than trying to guess from the
database.

In the general case, if there are any INSERT/UPDATE/DELETE RULEs on a
view, there is no way for the client to determine what the effect will
be except in the simplest of cases, letting the user specify seems the
best bet.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: Robert Treat
Date:
Subject: Re: Why does an ON SELECT rule have to be named "_RETURN"?
Next
From: Richard Huxton
Date:
Subject: Re: NULLs in unique indexes; Was: Oracle purchases Sleepycat