Re: insert rule doesn't see id field

From: Ron Peterson <rpeterso(at)mtholyoke(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: insert rule doesn't see id field
Date: 2003-01-09 19:12:58
Message-ID: 20030109191258.GA6739@mtholyoke.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches pgsql-sql

On Wed, Jan 08, 2003 at 01:13:03PM -0500, Ron Peterson wrote:
> On Tue, Jan 07, 2003 at 11:01:08AM -0500, Tom Lane wrote:
>
> > > I thought that the idea behind noup was to protect single columns from
> > > update. However, when I apply the noup trigger as above, I can't
> > > update /any/ column. Is this the intended behaviour?
> >
> > Idly looking at the source code for contrib/noupdate/noup.c, I don't
> > believe that it has ever worked as advertised: it seems to reject any
> > non-null value for the target column, independently of whether the
> > value is the same as before (which is what I'd have thought it should
> > do).
> >
> > Is anyone interested in fixing it? Or should we just remove it?
> > If it's been there since 6.4 and you're the first person to try to use
> > it, as seems to be the case, then I'd have to say that it's a waste of
> > space in the distribution.
>
> I'm going to see if I can create this function.

Well, I think I've thunk something up. Of course I'm happy to submit
my modification for distribution or ridicule, as the case may be.
Where should I submit this?

I made a function noupcols() which takes one or more column names as
arguments. The function then creates a new tuple by getting the old
values for those columns, and then doing an SPI_modifytuple on the new
tuple using the old values for those columns.

I'm kind of flying by the seat of my pants here, so if anyone would
care to critically review my code, by all means...

--
Ron Peterson -o)
Network & Systems Manager /\\
Mount Holyoke College _\_v
http://www.mtholyoke.edu/~rpeterso ----

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message dev 2003-01-09 19:54:04 Re: insert rule doesn't see id field
Previous Message Lee Kindness 2003-01-09 15:25:07 Re: [PATCHES] PostgreSQL libraries - PThread Support, but not use...

Browse pgsql-sql by date

  From Date Subject
Next Message Achilleus Mantzios 2003-01-09 19:29:09 Re: SQL function parse error ?
Previous Message Radu-Adrian Popescu 2003-01-09 17:37:03 Re: SQL function parse error ?