From: Hengky Lie <hengkyliwandouw@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Rule Error
Date: Thu, 4 Oct 2007 19:22:32 +0800
Message-ID: <008f01c80678$de562990$6f00a8c0@hengky> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: hengkyliwandouw@gmail.com
Subject: Re: Rule Error
In-Reply-To: <008f01c80678$de562990$6f00a8c0@hengky>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox