pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Doug Younger <postgres@mindspring.com>
To: pgsql-sql@postgresql.org
Subject: Create Rule problems
Date: Fri, 14 May 1999 13:50:51 -0400
Message-ID: <4.1.19990514135041.009646d0@proxy> (raw)

Hello,
  I'm trying to set up some rules and was following the examples in the
Programmer's guide form the docs, and it gives an example similar to this:

CREATE RULE log_shoelace AS ON UPDATE TO shoelace_data
  WHERE NEW.sl_avail != OLD.sl_avail
DO INSERT INTO shoelace_log VALUES (
                 NEW.sl_name,
                 NEW.sl_avail,
                 getpgusername().
                 'now'::text
               );

What I want to do is very similar:

CREATE RULE update_login AS ON UPDATE TO user_info
  WHERE NEW.login != OLD.login
DO UPDATE user_dept SET login = NEW.login
  WHERE login = OLD.login;

I get an error:
"ERROR: Table old does not exist."
What's going on?

Also, the docs say you can do multiple actions in a rule... what is the syntax?
I tried putting the actions in parens separated by semicolons or commas wit
no luck...
There wasn't an example in the docs that did more than on action.   

Thanks,
  Doug. 



view thread (4+ messages)  latest in thread

Message-ID: <4.1.19990514135041.009646d0@proxy>
Permalink:  ../4.1.19990514135041.009646d0@proxy/
Also on:    postgresql.org/message-id/4.1.19990514135041.009646d0@proxy

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: postgres@mindspring.com
  Subject: Re: Create Rule problems
  In-Reply-To: <4.1.19990514135041.009646d0@proxy>
  References: <4.1.19990514135041.009646d0@proxy>

* 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