Skip site navigation (1) Skip section navigation (2)

my rules wont execute

From: "aldy" <aldy(at)teodore(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: my rules wont execute
Date: 2008-10-20 08:23:59
Message-ID: 003001c9328d$352737f0$c801a8c0@italdy (view raw or flat)
Thread:
Lists: pgsql-sql
hai all,

please help me, i've made a view named bpbkain

CREATE OR REPLACE VIEW gmt.bpbkain AS 
 SELECT bpb.tanggal AS tgl_bukti, n.supplier, bpb.nobukti, n.no_po, n.jenis_kain, n.gramasi, n.warna, n.lebar, n.no_inv, n.harga, n.sat_harga, COALESCE(sum(netto2.netto), 0::double precision)::numeric(15,2) AS ncqty, n.qty, n.bruto, n.order_no, n.style
   FROM gmt.netto n
   LEFT JOIN ( SELECT netto_child.id_netto, sum(netto_child.kg) AS netto
           FROM gmt.netto_child
          GROUP BY netto_child.id_netto
          ORDER BY netto_child.id_netto) netto2 USING (id_netto)
   JOIN gmt.bpb USING (id_bpb)
  GROUP BY bpb.tanggal, n.supplier, bpb.nobukti, n.no_po, n.jenis_kain, n.gramasi, n.warna, n.lebar, n.no_inv, n.harga, n.sat_harga, n.order_no, n.style, n.qty, n.bruto
  ORDER BY bpb.tanggal, n.supplier, bpb.nobukti, n.no_po, n.jenis_kain, n.gramasi, n.warna, n.lebar, n.no_inv, n.harga, n.sat_harga;

ALTER TABLE gmt.bpbkain OWNER TO teoadm;
GRANT SELECT, UPDATE, INSERT, DELETE, REFERENCES, TRIGGER ON TABLE gmt.bpbkain TO teoadm;
GRANT SELECT ON TABLE gmt.bpbkain TO pm;
GRANT SELECT, UPDATE, INSERT, TRIGGER ON TABLE gmt.bpbkain TO acct;

i've made the rule too, to update a table while the view changes

CREATE OR REPLACE RULE upd_nett AS
    ON UPDATE TO gmt.bpbkain DO INSTEAD  UPDATE gmt.netto SET harga = new.harga, sat_harga = new.sat_harga, no_inv = new.no_inv
  WHERE netto.supplier::text = new.supplier::text AND netto.no_po::text = new.no_po::text AND netto.jenis_kain::text = new.jenis_kain::text AND netto.gramasi::text = new.gramasi::text AND netto.warna::text = new.warna::text AND netto.lebar::text = new.lebar::text AND netto.harga = old.harga AND netto.sat_harga::text = old.sat_harga::text AND netto.order_no::text = new.order_no::text AND netto.no_inv::text = old.no_inv::text;

but when i made some changes to that view it doesn't make any change for my table...any body help meeee

pgsql-sql by date

Next:From: Patrick ScharrenbergDate: 2008-10-20 13:24:38
Subject: generating date sequences
Previous:From: Gerardo HerzigDate: 2008-10-17 12:50:26
Subject: Re: returning count(*) when it is > 1, else -1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group