Thread: It's a bug???? 8-()

It's a bug???? 8-()

From
Vic
Date:
  Hello, deary ALL !   What your say about this :
   I-have-a-simple-table :

create  table task_l(
 n serial,
 event       text,
 URL         text,                      /* ссылка */
 PID         int,                       /* PID   wget-а для  данной
задачи*/
 descripition  text,                    /*описание*/
 start_time  datetime DEFAULT (now()),  /* время запуска*/
 end_time    datetime,                  /*время  останова*/
 status      text                       /*результат выполнения :
OK,ERROR,ABORTED */
);
/*   AND RULE      */
create rule r_3 as
on UPDATE to task_l.url do
update task_l set start_time=now();

AND..... ERROR!!!!:

psql:3.sql:3: ERROR:  attribute level rules currently not supported

But is the another  solution  for  that's task : "write in EACH record
date-time last change!(or last  select  acces)"

 Ok.  Its  not  a error - its a  feature ( IMHO very stupid ;-\  )
create rule r_3 as
on UPDATE to task_l.url do
                    ^^^^^^^ I remove  this and  get forever-loop when
user update  start_time.
Yes  I make  field start_time in client  read-only, but..... its
solution  only for   one case !!!!
  Does any-body tell me best solution???

with regards   Vic.

Re: It's a bug???? 8-()

From
Tom Lane
Date:
Vic <vic@dcc.dp.ua> writes:
> create rule r_3 as
> on UPDATE to task_l.url do
> update task_l set start_time=now();

> psql:3.sql:3: ERROR:  attribute level rules currently not supported

You'll have better luck (and probably better performance, anyway) doing
this with an ON UPDATE trigger, instead of a rule.

            regards, tom lane

Re: It's a bug???? 8-()

From
Vic
Date:
Hello, Tom.
Tom Lane пишет:
> You'll have better luck (and probably better performance, anyway) doing
> this with an ON UPDATE trigger, instead of a rule.
  But, can  your  know  something about  ".... attribute level rules".
 This rules  supported in other releases PG. ?
 And   -  i can't  know how in trigger_function i may release
 this update .....   without forever loop.
 You have any idea?