Re: sql DO in rule 9.0rc1 - Mailing list pgsql-general

From A.M.
Subject Re: sql DO in rule 9.0rc1
Date
Msg-id FE3898C3-37CA-4BB0-9066-44CAE7E8A69F@themactionfaction.com
Whole thread Raw
In response to Re: sql DO in rule 9.0rc1  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: sql DO in rule 9.0rc1
List pgsql-general
On Sep 9, 2010, at 8:31 PM, Jeff Davis wrote:

> On Thu, 2010-09-09 at 17:07 -0400, A.M. wrote:
>> Is there a technical limitation which prevents DO from being used in rules or am I missing something with this?
>>
>> CREATE RULE test_update AS ON UPDATE TO test DO INSTEAD DO $$
                   
>>                 BEGIN;
                                          
>>                 RAISE NOTICE 'hello';
                                          
>>                 END;
                                          
>>               $$;
>>
>> Cheers,
>> M
>
>> From the docs here:
>
>    http://www.postgresql.org/docs/9.0/static/sql-createrule.html
>
> I see:
>
>    "Valid commands are SELECT, INSERT, UPDATE, DELETE, or NOTIFY."
>
> And I assume that DO is a separate command that is not valid for a rule
> such as this.
>
> As a workaround, you can make a named function and do "SELECT
> myfunction()" as the INSTEAD clause.

Perhaps I should have posted to -hackers instead, but I was really wondering if there were some real technical
limitationto having this implemented. Does "DO" have any sort of context which can be applied? It seems that NEW and
OLDwould have to be pushed into that context. 

Cheers,
M

pgsql-general by date:

Previous
From: Richard Broersma
Date:
Subject: Re: regexp on null
Next
From: Arjen Nienhuis
Date:
Subject: Re: Post Install / Secure PostgreSQL