Re: Why doesn't this pgsql function compile?

From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Joe Conway <joseph(dot)conway(at)home(dot)com>
Cc: PostgreSQL SQL List <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Why doesn't this pgsql function compile?
Date: 2001-06-16 03:36:08
Message-ID: 20010615223608.A23252@lerami.lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

* Larry Rosenman <ler(at)lerctr(dot)org> [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 <joseph(dot)conway(at)home(dot)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';
> >
> >
>
> ---------------------------(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(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Craig Longman 2001-06-16 05:07:29 casts and conversions
Previous Message Larry Rosenman 2001-06-15 22:43:53 Re: Why doesn't this pgsql function compile?