Re: Why doesn't this pgsql function compile?
От | Larry Rosenman |
---|---|
Тема | Re: Why doesn't this pgsql function compile? |
Дата | |
Msg-id | 20010615174353.A55366@ler-freebie.iadfw.net обсуждение исходный текст |
Ответ на | Why doesn't this pgsql function compile? (Larry Rosenman <ler@lerctr.org>) |
Ответы |
Re: Why doesn't this pgsql function compile?
(Larry Rosenman <ler@lerctr.org>)
|
Список | pgsql-sql |
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'; > >
В списке pgsql-sql по дате отправления: