Received: from lerami.lerctr.org (lerami.lerctr.org [207.158.72.11]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5G3aDa70103 for ; Fri, 15 Jun 2001 23:36:13 -0400 (EDT) (envelope-from ler@lerctr.org) Received: from lerami.lerctr.org (localhost [127.0.0.1]) by lerami.lerctr.org (8.12.0.Beta12/8.12.0.Beta12/20010318/$Revision: 1.22 $) with ESMTP id f5G3a8uo023342; Fri, 15 Jun 2001 22:36:08 -0500 (CDT) Received: (from ler@localhost) by lerami.lerctr.org (8.12.0.Beta12/8.12.0.Beta12) id f5G3a8pI023341; Fri, 15 Jun 2001 22:36:08 -0500 (CDT) Date: Fri, 15 Jun 2001 22:36:08 -0500 From: Larry Rosenman To: Joe Conway Cc: PostgreSQL SQL List Subject: Re: Why doesn't this pgsql function compile? Message-ID: <20010615223608.A23252@lerami.lerctr.org> References: <20010615170950.A3303@lerami.lerctr.org> <005101c0f5ec$83f56b80$d7d310ac@jecw2k1> <20010615174353.A55366@ler-freebie.iadfw.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010615174353.A55366@ler-freebie.iadfw.net> User-Agent: Mutt/1.3.19i X-Mailer: Mutt http://www.mutt.org/ X-Archive-Number: 200106/224 X-Sequence-Number: 3482 * Larry Rosenman [010615 17:47]: > > Yes, I found that out, as well as needing to save off > the new. and old. var's... > > :-) BTW, thanks, guys..... Too much staring at code... I *REALLY* appreciate the good eyes... It's now working! :-) (my first set of triggers), and it even talks to the routers... PeterE: Thanks for PL/sh, I'm using it to launch a couple of python scripts to actually do the router talking and mail us. LER > > LER > > * Joe Conway [010615 17:43]: > > > > > When this PLpgsql function gets called on the trigger > > > it fails compilation on the last line. > > > > > > What am I doing wrong? > > > > > > > > > > > > > > > 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'; > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl > -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749