pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jwieck@debis.com
To: rems@gdansk.sprint.pl
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] rules
Date: Fri, 5 Mar 1999 16:58:15 +0100 (MET)
Message-ID: <m10IwzP-000EBQC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <Pine.GS4.4.02A.9903051235480.58-100000@netra.gdansk.sprint.pl>

> I try to create two rules
> -first one on update one_id in one table
> CREATE RULE rupd_one AS ON UPDATE TO one
>    DO UPDATE many
>         SET many_onef = new.one_id
>         WHERE many_onef = current.one_id;
>
> -second one on delete record from one table
> CREATE RULE rdel_one AS ON DELETE TO one
>    DO DELETE FROM many
>         WHERE many_onef = old.one_id;
>
> In short these two seem don't work. I'm not sure of either syntax or some
> other errors - psql at first rule don't report any errors, just output
> UPDATE 0
> and second one usually something like this:
> PQexec() -- Request was sent to backend, but backend closed the channel
> before responding.
>         This probably means the backend terminated abnormally before or
> while processing the request.

    There  seems  nothing  wrong  with the rules, except that you
    should use OLD instead of CURRENT  in  the  update  rule  too
    because CURRENT will disappear in v6.5.

    But  from  the  'UPDATE  0'  I  guess you're using a Postgres
    version prior to v6.4 - right? I fixed the  rule  system  for
    v6.4,  before that it was so badly broken that you should not
    even try.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #





view thread (22+ messages)  latest in thread

Message-ID: <m10IwzP-000EBQC@orion.SAPserv.Hamburg.dsh.de>
Permalink:  ../m10IwzP-000EBQC@orion.SAPserv.Hamburg.dsh.de/
Also on:    postgresql.org/message-id/m10IwzP-000EBQC@orion.SAPserv.Hamburg.dsh.de

 · 

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: jwieck@debis.com, rems@gdansk.sprint.pl
  Subject: Re: [SQL] rules
  In-Reply-To: <m10IwzP-000EBQC@orion.SAPserv.Hamburg.dsh.de>

* 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