pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Larry Rosenman <ler@lerctr.org>
To: Joe Conway <joseph.conway@home.com>
Cc: PostgreSQL SQL List <pgsql-sql@postgresql.org>
Subject: Re: Why doesn't this pgsql function compile?
Date: Fri, 15 Jun 2001 17:43:53 -0500
Message-ID: <20010615174353.A55366@ler-freebie.iadfw.net> (raw)
In-Reply-To: <005101c0f5ec$83f56b80$d7d310ac@jecw2k1>
References: <20010615170950.A3303@lerami.lerctr.org>
	<005101c0f5ec$83f56b80$d7d310ac@jecw2k1>

Yes, I found that out, as well as needing to save off 
the new. and old. var's...

:-) 

LER

* Joe Conway <joseph.conway@home.com> [010615 17:43]:
> 
> > When this PLpgsql function gets called on the trigger
> > it fails compilation on the last line.
> >
> > What am I doing wrong?
> >
> >
> 
> <snip>
> 
> >     IF TG_OP = ''INSERT''
> >     THEN add_ip_route(host(network(NEW.netblock)),
> >                       host(netmask(NEW.netblock)),
> >                       get_router_ethernet(NEW.router),
> >                       get_router_nexthop(NEW.router),
> >                       get_router_nexthop_user(NEW.router),
> >                       get_router_nexthop_password(NEW.router),
> >                       get_router_nexthop_enpass(NEW,router));
> >          return NEW;
> >     END IF;
> 
> Don't you need a "PERFORM" between the "THEN" and "add_ip_route(. . ." above
> (and similar places below)?
> 
> -- Joe
> 
> >    IF TG_OP = ''DELETE''
> >    THEN del_ip_route(host(network(OLD.netblock)),
> >                      host(netmask(OLD.netblock)),
> >                      get_router_ethernet(OLD.router),
> >                      get_router_nexthop(OLD.router),
> >                      get_router_nexthop_user(OLD.router),
> >                      get_router_nexthop_password(OLD.router),
> >                      get_router_nexthop_enpass(OLD,router));
> >         return OLD;
> >    -- TG_OP must be UPDATE to get here....
> >    IF OLD.router NOTNULL and get_router_nexthop(OLD.router) NOTNULL
> >       AND NEW.router NOTNULL and OLD.router != NEW.router
> >    THEN del_ip_route(host(network(OLD.netblock)),
> >                      host(netmask(OLD.netblock)),
> >                      get_router_ethernet(OLD.router),
> >                      get_router_nexthop(OLD.router),
> >                      get_router_nexthop_user(OLD.router),
> >                      get_router_nexthop_password(OLD.router),
> >                      get_router_nexthop_enpass(OLD,router));
> >     END IF;
> >     IF NEW.router NOTNULL and get_router_nexthop(NEW.router) NOTNULL
> >     THEN add_ip_route(host(network(NEW.netblock)),
> >                      host(netmask(NEW.netblock)),
> >                      get_router_ethernet(NEW.router),
> >                      get_router_nexthop(NEW.router),
> >                      get_router_nexthop_user(NEW.router),
> >                      get_router_nexthop_password(NEW.router),
> >                      get_router_nexthop_enpass(NEW,router));
> >     END IF;
> >     return NEW;
> >    END;'
> > LANGUAGE 'plpgsql';
> 
> 



view thread (5+ messages)  latest in thread

Message-ID: <20010615174353.A55366@ler-freebie.iadfw.net>
Permalink:  ../20010615174353.A55366@ler-freebie.iadfw.net/
Also on:    postgresql.org/message-id/20010615174353.A55366@ler-freebie.iadfw.net

 · 

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: ler@lerctr.org, joseph.conway@home.com
  Subject: Re: Why doesn't this pgsql function compile?
  In-Reply-To: <20010615174353.A55366@ler-freebie.iadfw.net>

* 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