Re: Deleting From View?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Jeanna Geier <jgeier(at)apt-cafm(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Deleting From View?
Date: 2007-01-05 21:26:34
Message-ID: 20070105212634.GD27598@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jan 05, 2007 at 10:22:38AM -0600, Jeanna Geier wrote:
> Interestingly enough... he doesn't have an INSERT rule...
>
> The INSERTs all appear to be done using the JDBC and prepared statements in
> the code.

Well, I think that's going to make your job difficult then. Obviously
whatever is happening, the insert code is doing more than expected.

Remember, a view is the result of a query, it's not hard to create
views where you can't do meaningful DELETE rules. In your example
you're joining many tables. If any of those tables have a duplicate
value, that would duplicate records in the result. You can't delete any
particular duplicate because it is the result, not the cause.

Hope this helps,

> -----Original Message-----
> From: Martijn van Oosterhout [mailto:kleptog(at)svana(dot)org]
> Sent: Friday, January 05, 2007 10:16 AM
> To: Jeanna Geier
> Cc: pgsql-general
> Subject: Re: [GENERAL] Deleting From View?
>
>
> On Fri, Jan 05, 2007 at 09:59:34AM -0600, Jeanna Geier wrote:
> > Thanks for the quick reply; that's one of the many reasons why this list
> is
> > so awesome...
> >
> > I'm taking this project over from somebody else and am new to the DB side
> of
> > things, so I'm still learning - you're responses and thoughts are greatly
> > appreciated!
>
> You didn't post the INSERT rule.
>
> However, what's truly interesting is that you do have a delete rule,
> yet you're getting an exception. Which indicates the exception is being
> generated from within java, and not by postgresql at all. Obviously,
> whatever trick that was applied to convince java to insert into a view
> needs to be used to make the delete work.
>
> Wouldn't fixing the insert rule be better?
>
> Have a nice day,
> --
> Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> > From each according to his ability. To each according to his ability to
> litigate.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Geoffrey 2007-01-05 21:29:50 vacuum fails with 'invalid page header' message
Previous Message Jorge Godoy 2007-01-05 21:25:20 Re: Database versus filesystem for storing images