pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joel Burton <joel@joelburton.com>
Cc: Aasmund Midttun Godal <postgresql@envisity.com>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: CREATE RULE ON UPDATE/DELETE
Date: Sun, 21 Oct 2001 12:47:41 -0400
Message-ID: <28356.1003682861@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.30.0110202326080.6433-100000@temp.joelburton.com>
References: <Pine.LNX.4.30.0110202326080.6433-100000@temp.joelburton.com>

Joel Burton <joel@joelburton.com> writes:
> CREATE VIEW dbl AS SELECT id * 2 as id, name FROM raw;

> CREATE RULE dbl_update AS ON UPDATE TO dbl DO INSTEAD UPDATE raw SET
> id = NEW.id, name = NEW.name WHERE OLD.id = id;

Surely you'd need something like

CREATE RULE dbl_update AS ON UPDATE TO dbl DO INSTEAD UPDATE raw SET
id = NEW.id / 2, name = NEW.name WHERE OLD.id = id * 2;

(untested...)

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <28356.1003682861@sss.pgh.pa.us>
Permalink:  ../28356.1003682861@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28356.1003682861@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, joel@joelburton.com, postgresql@envisity.com, pgsql-hackers@postgresql.org
  Subject: Re: CREATE RULE ON UPDATE/DELETE
  In-Reply-To: <28356.1003682861@sss.pgh.pa.us>

* 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