Rule Error

From: "Hengky Lie" <hengkyliwandouw(at)gmail(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Rule Error
Date: 2007-10-04 11:22:32
Message-ID: 008f01c80678$de562990$6f00a8c0@hengky
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dear Friends,

I have problem with rule and tried several times to solve it but not yet
success. Hope someone can help me.

I have 2 tables : tblmasdbt and tblmasgl.

I want on every record insertion in tblmasdbt, that record also
automatically insert into tblmasdbt. I need only 2 related field.

So I create rule like this

--------------- SQL ---------------

CREATE RULE "rule1" AS ON INSERT TO "public"."tblmasdbt"

DO (insert into tblmasgl (KODEGL,NAMAREK) VALUES (new.KODEGL, new.NAMAREK));

But I always get this error :

---------- ERROR MESSAGE ----------

ERROR: column "kodegl" of relation "tblmasgl" does not exist

Here is the Table Structure

---------------------------

CREATE TABLE "public"."tblmasgl" (

"KODEGL" VARCHAR(15) NOT NULL,

"NAMAREK" VARCHAR(50),

"GOLONGAN" VARCHAR(10),

"AWAL" DOUBLE PRECISION DEFAULT 0,

"Operator" VARCHAR(3),

CONSTRAINT "tblmasgl_pkey" PRIMARY KEY("KODEGL"),

CONSTRAINT "tblmasgl_fk" FOREIGN KEY ("KODEGL")

REFERENCES "public"."tbltragl"("KODEGL")

ON DELETE CASCADE

ON UPDATE NO ACTION

NOT DEFERRABLE

) WITHOUT OIDS;

CREATE TABLE "public"."tblmasdbt" (

"KODEGL" VARCHAR(15) NOT NULL,

"NAMAREK" VARCHAR(50),

"ALAMAT" VARCHAR(75),

"Telp" VARCHAR(50),

"Facs" VARCHAR(50),

"KOTA" VARCHAR(30),

"HP" VARCHAR(20),

"Plafond" DOUBLE PRECISION DEFAULT 0,

"Operator" VARCHAR(3),

"SALDOAWAL" DOUBLE PRECISION DEFAULT 0,

CONSTRAINT "tblmasdbt_pkey" PRIMARY KEY("KODEGL")

) WITHOUT OIDS;

Hope someone could help me. Thanks a lot

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2007-10-04 12:53:24 Re: Rule Error
Previous Message yogesh 2007-10-04 09:26:07 Postgres Array Traversing Problem