Re: Why does an ON SELECT rule have to be named "_RETURN"?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: pgsql-general(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>, ken(at)sunward(dot)org
Subject: Re: Why does an ON SELECT rule have to be named "_RETURN"?
Date: 2006-02-16 12:54:39
Message-ID: 20060216125439.GF26127@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Emi Lu 2006-02-16 14:12:51 A question about Vacuum analyze
Previous Message Richard Huxton 2006-02-16 12:54:29 Re: NULLs in unique indexes; Was: Oracle purchases Sleepycat