pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: wieck@debis.com
To: wayne@senet.com.au
Cc: pgsql-sql@postgreSQL.org
Cc: pgsql-hackers@postgreSQL.org
Cc: jmr@computing.com
Subject: Re: [HACKERS] Re: trouble creating log table with rules
Date: Fri, 25 Jun 1999 14:09:28 +0200 (MET DST)
Message-ID: <m10xUnQ-0003kvC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <199906250652.QAA29938@helpdesk.senet.com.au>

>
> > Date: Thu, 24 Jun 1999 01:53:05 -0500
> > From: Jim Rowan <jmr@computing.com>
> > Subject: trouble creating log table with rules
> >
> > I've read the docs in the programmers manual, and can create rules like this:
> >
> > CREATE RULE "m_log_change" AS ON UPDATE TO "machine"
> > do (
> >   INSERT INTO machine_log (who, date, machnum, col, newval)
> >     SELECT getpgusername(), 'now'::text, old.machnum,
> >   'host', new.host
> >     WHERE (new.host != old.host) or
> >  (old.host IS NOT NULL and new.host IS NULL) or
> >       (old.host IS NULL and new.host IS NOT NULL);
> >
> >   INSERT INTO machine_log (who, date, machnum, col, newval)
> >     SELECT getpgusername(), 'now'::text, old.machnum,
> >   'serial_num_cpu', new.serial_num_cpu
> >     WHERE (new.serial_num_cpu != old.serial_num_cpu) or
> >  (old.serial_num_cpu IS NOT NULL and new.serial_num_cpu IS NULL) or
> >       (old.serial_num_cpu IS NULL and new.serial_num_cpu IS NOT NULL);
> > );
> >
> > My big problem is that if I replicate this enough times to cover the fields I
> > want, I get this error:
> >
> > pqReadData() -- backend closed the channel unexpectedly.
> >         This probably means the backend terminated abnormally
> >         before or while processing the request.
> > We have lost the connection to the backend, so further processing is impossible.  Terminating.
> >

    You  didn't  tell  us  which  version of PostgreSQL and (more
    important) if the error occurs during  CREATE  RULE  or  when
    updating machine.

    If  it occurs during the CREATE RULE (what I hope for you) it
    doesn't happen in the rewriter itself. For the  rule  actions
    in  the  example above it isn't important in which order they
    are processed. So you could setup  single  action  rules  per
    field to get (mostly) the same results.

    If  you  can  create the entire multi action rule but get the
    backend crash during UPDATE of machine, then it's  a  problem
    in the rewriter which I cannot imagine looking at your rules.


Jan

--

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





view thread (4+ messages)  latest in thread

Message-ID: <m10xUnQ-0003kvC@orion.SAPserv.Hamburg.dsh.de>
Permalink:  ../m10xUnQ-0003kvC@orion.SAPserv.Hamburg.dsh.de/
Also on:    postgresql.org/message-id/m10xUnQ-0003kvC@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 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: wieck@debis.com, wayne@senet.com.au, pgsql-hackers@postgreSQL.org, jmr@computing.com
  Subject: Re: [HACKERS] Re: trouble creating log table with rules
  In-Reply-To: <m10xUnQ-0003kvC@orion.SAPserv.Hamburg.dsh.de>
  References: <199906250652.QAA29938@helpdesk.senet.com.au> <m10xUnQ-0003kvC@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