test1=# \d+ testb
View "public.testb"
Column | Type | Modifiers | Description
--------+---------+--------------------+-------------
id | bigint | |
pid | integer | |
b | integer | not null default 1 |
View definition:
SELECT testb.id, testb.pid, 1 AS b
FROM testb
WHERE testb.b <> 0;
test1=# insert into testb(id, pid) values (1, 666);
ERROR: infinite recursion detected in rules for relation "testb"
View "public.testb"
Column | Type | Modifiers | Description
--------+---------+--------------------+-------------
id | bigint | |
pid | integer | |
b | integer | not null default 1 |
View definition:
SELECT testb.id, testb.pid, 1 AS b
FROM testb
WHERE testb.b <> 0;
test1=# insert into testb(id, pid) values (1, 666);
ERROR: infinite recursion detected in rules for relation "testb"
I have to admit, I don't get that error. Rule is on select, not insert/update.
--