Re: Rule Error

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Rule Error
Дата
Msg-id 4704E244.3070402@archonet.com
обсуждение исходный текст
Ответ на Rule Error  ("Hengky Lie" <hengkyliwandouw@gmail.com>)
Список pgsql-sql
Hengky Lie wrote:
> 
> 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.

You probably want triggers rather than rules, but anyway.

> 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:  column "kodegl" of relation "tblmasgl" does not exist

There is not a column called kodegl on table tblmasgl.

> Here is the Table Structure 

> CREATE TABLE "public"."tblmasgl" (
>   "KODEGL" VARCHAR(15) NOT NULL, 

There you go - you double-quoted the column-name when creating the 
table. That means that it is literally "KODEGL" and will not match 
kodegl or KoDeGl or any other combination of upper and lower case.

If you double-quote column-names when you create a table you'll want to 
double-quote them every time you use them too.

--   Richard Huxton  Archonet Ltd


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Hengky Lie"
Дата:
Сообщение: Rule Error
Следующее
От: "Bart Degryse"
Дата:
Сообщение: Re: Rule Error