"ON INSERT rule may not use OLD" on simple query - Mailing list pgsql-general

From Brandon Craig Rhodes
Subject "ON INSERT rule may not use OLD" on simple query
Date
Msg-id w6bs1j7m9f.fsf@guinness.ts.gatech.edu
Whole thread Raw
Responses Re: "ON INSERT rule may not use OLD" on simple query
List pgsql-general
Postgresql 7.3.2 gives the error "ON INSERT rule may not use OLD" when
trying to define the following rule:

        CREATE TABLE numbers ( number INTEGER );
        CREATE TABLE other_numbers ( number INTEGER );

        CREATE OR REPLACE RULE number_rule AS
        ON INSERT TO numbers
        DO INSERT INTO other_numbers
          SELECT 1 EXCEPT SELECT 2;

although the rule, even upon close inspection, seems to make no
reference at all to the OLD pseudo-relation.  Given the above table
definitions, the query:

        SELECT 1 EXCEPT SELECT 2;

by itself runs fine and returns 1 as expected.  (We have tested this
against both the unstable Debian package for 7.3.2, and against a copy
compiled locally using the standard source archive.)

--
Brandon Craig Rhodes                         http://www.rhodesmill.org/brandon
Georgia Tech                                            brandon@oit.gatech.edu

pgsql-general by date:

Previous
From: Richard Welty
Date:
Subject: arrays and pl/pgsql?
Next
From: Tom Lane
Date:
Subject: Re: 7.3.2: test select_having ... FAILED