Bug #568: RULE ON SELECT with old values. - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #568: RULE ON SELECT with old values.
Date
Msg-id 200201241745.g0OHjx510702@postgresql.org
Whole thread Raw
Responses Re: Bug #568: RULE ON SELECT with old values.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Vadim Passynkov (Vadim.Passynkov) reports a bug with a severity of 4
The lower the number the more severe it is.

Short Description
RULE ON SELECT with old values.

Long Description
# SELECT version();
                           version
--------------------------------------------------------------
 PostgreSQL 7.1.3 on i386--freebsd4.4, compiled by GCC 2.95.3

# \d  routers_password

    Table "routers_password"
 Attribute |  Type   | Modifier
-----------+---------+----------
 obj_id    | integer | not null
 userpwd   | text    |
 super     | text    |
Index: routers_password_pkey
Constraints: (userpwd !~ '[[:space:]]'::text)
             (super !~ '[[:space:]]'::text)


# CREATE RULE routers_password_test AS ON SELECT TO routers_password DO INSTEAD SELECT old.obj_id, old.userpwd,
old.super;

ERROR:  ON SELECT rule may not use OLD


From PostgreSQL Documentation:

Within the condition  and action, the special table names new and old may be used to refer to values in the referenced
table(the object). new is valid in ON INSERT and ON UPDATE rules to refer to the new row being inserted or updated. old
isvalid in ON SELECT, ON UPDATE, and ON DELETE rules to refer to the existing row being selected, updated, or deleted. 

--
Vadim Passynkov

Sample Code


No file was uploaded with this report

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problems with my server...
Next
From: Tom Lane
Date:
Subject: Re: Bug #568: RULE ON SELECT with old values.