Hello,
pg_get_ruledef cannot read the following rule:
test=# select version(); version
---------------------------------------------------------------------PostgreSQL 7.2b3 on i686-pc-linux-gnu, compiled by
GCCegcs-2.91.66
(1 row)
With the following tables:
test=# \d rd Table "rd"Column | Type | Modifiers
--------+----------+-----------a | smallint |b | smallint |c | text |
Table "ri"Column | Type | Modifiers
--------+----------+--------------d | smallint |e | text |a | smallint | default 1000b |
smallint| default 2000
I create the following rule:
CREATE RULE ins_rd
AS ON INSERT TO ri
WHERE NEW.a IS NOT NULL AND NEW.b IS NOT NULL
DO INSERT INTO rd (a,b) select distinct new.a,new.b
The rule works well. But when i select pg_rules:
test=# select * from pg_rules;
ERROR: Invalid attnum 3 for rangetable entry *SELECT*
Thanks in advance
Sergio.