pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dev@archonet.com
To: Ron Peterson <rpeterso@mtholyoke.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: insert rule doesn't see id field
Date: Thu, 9 Jan 2003 19:54:04 -0000 (GMT)
Message-ID: <2930.192.168.1.16.1042142044.squirrel@mainbox.archonet.com> (raw)
In-Reply-To: <20030109191258.GA6739@mtholyoke.edu>
References: <20030107145422.GE12245@mtholyoke.edu>
	<13558.1041955268@sss.pgh.pa.us>
	<20030108181303.GA23456@mtholyoke.edu>
	<20030109191258.GA6739@mtholyoke.edu>

> 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?
>> >

>> 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...

Sounds similar to the plpgsql example at:

http://www.archonet.com/pgdocs/lock-field.html

which silently discards changes. It's trivial (apart from quoting issues)
to write a trigger generator to customise the above in plpgsql (see the
Cookbook on techdocs.postgresql.org for examples)

- Richard Huxton



view thread (14+ messages)  latest in thread

Message-ID: <2930.192.168.1.16.1042142044.squirrel@mainbox.archonet.com>
Permalink:  ../2930.192.168.1.16.1042142044.squirrel@mainbox.archonet.com/
Also on:    postgresql.org/message-id/2930.192.168.1.16.1042142044.squirrel@mainbox.archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, rpeterso@mtholyoke.edu
  Subject: Re: insert rule doesn't see id field
  In-Reply-To: <2930.192.168.1.16.1042142044.squirrel@mainbox.archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox