BUG #5203: Rule affecting more than one row is only fired once, when there is no reference to the row.

Поиск
Список
Период
Сортировка
От Marcel Wieland
Тема BUG #5203: Rule affecting more than one row is only fired once, when there is no reference to the row.
Дата
Msg-id 200911201511.nAKFBJoq079158@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #5203: Rule affecting more than one row is only fired once, when there is no reference to the row.
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      5203
Logged by:          Marcel Wieland
Email address:      marcel.wieland@fondsnet.de
PostgreSQL version: 8.2
Operating system:   Linux
Description:        Rule affecting more than one row is only fired once,
when there is no reference to the row.
Details:

BEGIN;

-- Create testing Tables
CREATE TABLE footable (
    name char
);
CREATE TABLE bartable (
    foo char
);

-- Insert testing Values
INSERT INTO footable (name) VALUES('a'), ('b');

-- RULE without row-reference
CREATE OR REPLACE RULE foorule AS ON UPDATE TO footable DO
    INSERT INTO bartable (foo) SELECT * FROM (SELECT 'a' UNION SELECT 'b')
AS x;

-- Query fires Rule
UPDATE footable SET name = name;
-- Result
SELECT * FROM bartable;

-- Reset
DELETE FROM bartable;

-- RULE with row-reference
CREATE OR REPLACE RULE foorule AS ON UPDATE TO footable DO
    INSERT INTO bartable (foo) SELECT * FROM (SELECT 'a' UNION SELECT 'b')
AS x WHERE old.name = old.name;

-- Query fires Rule
UPDATE footable SET name = name;
-- Result
SELECT * FROM bartable;

-- Cleanup
DROP TABLE footable;
DROP TABLE bartable;

ROLLBACK;

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

Предыдущее
От: "Marcel Wieland"
Дата:
Сообщение: BUG #5202: Rule affecting more than one row is only fired once with LIMIT 1
Следующее
От: "Alan Martin"
Дата:
Сообщение: BUG #5204: ODBC connection NOT working