From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
---|---|
To: | "A(dot)M(dot)" <agentm(at)themactionfaction(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: sql DO in rule 9.0rc1 |
Date: | 2010-09-10 00:31:56 |
Message-ID: | 1284078716.8089.1.camel@jdavis-ux.asterdata.local |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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.
Regards,
Jeff Davis
From | Date | Subject | |
---|---|---|---|
Next Message | Carlos Henrique Reimer | 2010-09-10 01:31:16 | User function canceling VACUUMDB utility |
Previous Message | Ungermann Carsten | 2010-09-09 23:23:59 | Re: Regular expression in an if-statement will not work |