Newbie question on RULEs .. or .. bug ?

Поиск
Список
Период
Сортировка
От Leif Jensen
Тема Newbie question on RULEs .. or .. bug ?
Дата
Msg-id Pine.LNX.4.58.0505171452550.10945@samba.crysberg.dk
обсуждение исходный текст
Ответы Re: Newbie question on RULEs .. or .. bug ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
     Hello,

   I have been working with a great database system called PostgreSQL for
many years  ;-)  but never had to use any RULEs. I now have to use and
update through a view and have written a few rules to make this possible
as per the manual.

   My insert rules seems to work fine, but I can't make the update rule do
what I want and as I believe stated in the manual.

   In the attached schema I have 2 basic tables and a view combining
those. I have 2 rules for insert on the view and these works fine. The
update rule, however, doesn't do what I want. The manual states that the
origsal query tree (where) is added to the rule qualification,
so I would exspect the update statement below would only update 1 row of
the ganntinfo table, but it updates all 5 ?

   What am I doing wrong ?


projtaskdb=# SELECT * FROM ganntinfo ;
 id  | seq | category |  name
-----+-----+----------+---------
  46 |   0 | SRC      | 2WWE
 172 |   0 | SRC      | RKD60
 138 |   0 | SRC      | Diverse
  34 |   0 | SRC      | VF
  87 |   0 | SRC      | 2WWE
(5 rows)

projtaskdb=# UPDATE tasks SET id = 87, category = 'SRC', name = '2WWE',
customer = 'Custm', description = 'test' WHERE id = 87 and category =
'SRC';
UPDATE 5
projtaskdb=# SELECT * FROM ganntinfo ;
 id | seq | category | name
----+-----+----------+------
 87 |   0 | SRC      | 2WWE
 87 |   0 | SRC      | 2WWE
 87 |   0 | SRC      | 2WWE
 87 |   0 | SRC      | 2WWE
 87 |   0 | SRC      | 2WWE
(5 rows)

projtaskdb=#


    I tried to put an 'explain' in front of the update within the update
rule, but got a syntax error. Why is that ?

    Please help,

 Leif

Вложения

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

Предыдущее
От: Angela Maduko
Дата:
Сообщение: Writing a join selectivity function
Следующее
От: ElayaRaja S
Дата:
Сообщение: Help - Urgent