rules problem

From: Georgi Chorbadzhiyski <gf(at)unixsol(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: rules problem
Date: 2003-03-21 10:18:01
Message-ID: 3E7AE6D9.80405@unixsol.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, I have strange problem with rules. It looks like when multiple rows
are affected, the rule is executed only for the first row.
Is this expected behaviour? Please someone hit me with a cluebat :)

Please try the attached two tests to see what I mean.
The tests are for pgsql-7.2 if you want to try them on 7.3 after
DROP TABLE xxx add CASCADE, and remove DROP RULE xxx lines.

Here's what I see:

*** First test ***
DROP
CREATE
DROP
CREATE
ERROR: Rule or view "add_to_data" not found
CREATE
ERROR: Rule or view "del_from_data" not found
CREATE
INSERT 357883308 1
INSERT 357883309 1
INSERT 357883310 1
INSERT 357883311 1
INSERT 357883312 1
id | data_counters | expected
----+---------------+------------------------------
1 | 4 | data_counters should be == 4
(1 row)

DELETE 4
id | data_counters | expected
----+---------------+------------------------------------
1 | 3 | data_counters should be == 0 NOT 3
(1 row)

*** Second test ***
DROP
CREATE
DROP
CREATE
ERROR: Rule or view "add_to_data" not found
CREATE
ERROR: Rule or view "del_from_data" not found
CREATE
INSERT 357886505 1
INSERT 357886506 1
INSERT 357886507 1
INSERT 357886508 1
INSERT 357886509 1
id | data_counters | expected
----+---------------+------------------------------
1 | 4 | data_counters should be == 4
(1 row)

DELETE 1
DELETE 1
DELETE 1
DELETE 1
id | data_counters | expected
----+---------------+------------------------------
1 | 0 | data_counters should be == 0
(1 row)

--
Georgi Chorbadzhiyski
http://georgi.unixsol.org/

Attachment Content-Type Size
boza-7.2-t1.sql.txt text/plain 1.0 KB
boza-7.2-t2.sql.txt text/plain 1.0 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua Moore-Oliva 2003-03-21 10:18:16 Re: rules problem
Previous Message Shridhar Daithankar<shridhar_daithankar@persistent.co.in> 2003-03-21 06:13:29 Re: [HACKERS] Extracting time from timestamp