Skip site navigation (1) Skip section navigation (2)

Bug #568: RULE ON SELECT with old values.

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #568: RULE ON SELECT with old values.
Date: 2002-01-24 17:45:59
Message-ID: 200201241745.g0OHjx510702@postgresql.org (view raw or flat)
Thread:
Lists: 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 is valid 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


Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2002-01-24 18:28:56
Subject: Re: Bug #568: RULE ON SELECT with old values.
Previous:From: Tom LaneDate: 2002-01-24 17:23:59
Subject: Re: Problems with my server...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group